Convert UTC time to specific time zone’s time
// list of timezones
var timezones = TimeZoneInfo.GetSystemTimeZones();
// choose your timezone to convert time
var convertedDateTime = TimeZoneInfo.ConvertTime(DateTime.UtcNow,
TimeZoneInfo.Utc, TimeZoneInfo.FindSystemTimeZoneById("India Standard Time"));
// choose your timezone time to utc time
var convertedDateTime = TimeZoneInfo.ConvertTime(DateTime.UtcNow,
TimeZoneInfo.FindSystemTimeZoneById("India Standard Time"),
TimeZoneInfo.Utc);
No comments:
Post a Comment