I am using the following method to convert utc datetime to datetime corresponding to other timezones
public string ConvertUTCDateTimetoUserDateTime(string utcDate)
{
DateTime userDateTime = new DateTime();
String displaydate = String.Empty;
try
{
destinationTimeZone = TimeZoneInfo.FindSystemTimeZoneById(TIMEZONE_ID);
DateTime returndt = Convert.ToDateTime(utcDate);
string strDate = String.Format("{0:" + DATE_FORMAT + " " + "HH:mm}", returndt);
sourceTimeZone = TimeZoneInfo.Utc;
string dateFormat = DATE_FORMAT + " " + "HH:mm";
DateTime unspecified = DateTime.ParseExact(strDate, dateFormat, CultureInfo.InvariantCulture);
userDateTime = TimeZoneInfo.ConvertTime(unspecified, sourceTimeZone, destinationTimeZone);
displaydate = userDateTime.ToString(DATE_FORMAT + " HH:mm");
}
catch (Exception ex)
{
}
return displaydate;
}
If I pass '03/19/2016 18:48' as UTC date and Timezone as "Atlantic Standard Time" (UTC-4:00) then it is converting it to '03/19/2016 15:48' which is Atlantic Daylight Time (UTC-3:00). Why is it considering DST for Atlantic Standard Time? Not all places in Atlantic time considers DST.For Eastern Standard Time (UTC-5:00) and Pacific Standard Time(UTC-8:00) the conversion is correct with DST.But why is this happening in case of Atlantic Time.For Atlantic Daylight Time there is no TimeZone ID either.I can add one hour by checking if it is AST but is there any better way of handling AST and ADT?