2
Answers

Time converison

Hi
 
I want to convert different time zones considering day light saving in c#.
How can i do this.Please suggest a solution.
I have tried this
 
 
int timezone;
TimeZoneInfo localZone = TimeZoneInfo.Local;
DateTime myTime = DateTime.Now;
bool isDayLight = TimeZoneInfo.Local.IsDaylightSavingTime(myTime);
if (isDayLight)
{
timezone = Math.Abs(localZone.BaseUtcOffset.Hours) + 1;
myTime = myTime.AddHours(1);
}
else
{
timezone = Math.Abs(localZone.BaseUtcOffset.Hours);
}
 
 In above code i have given  TimeZoneInfo.Local but i need to implement for all timezones.
 
 
 
 
Thanks 
Prachi 
 
Answers (2)