Lambda Expression for converting current datetime to Indian Standard Time / Eastern Standard Time (USA & Canada)

DateTime newTime = TimeZoneInfo.ConvertTime(DateTime.Now, TimeZoneInfo.FindSystemTimeZoneById(TimeZoneInfo.GetSystemTimeZones().Where(t => t.StandardName.Contains("India Standard Time")).First().Id));

 

DateTime newTime = TimeZoneInfo.ConvertTime(DateTime.Now, TimeZoneInfo.FindSystemTimeZoneById(TimeZoneInfo.GetSystemTimeZones().Where(t => t.StandardName.Contains("Eastern Standard Time")).First().Id));

Leave a Reply

Your email address will not be published. Required fields are marked *