i want to know the time difference between two countries.
There is ofcourse the static time difference, but during some periods the daylight saving time comes in between.
As far as i know the dst period is also different for some countries, so june 1 the diff between country a and b can be 1 hour, 1 july it can be 2 hours due to DST, and 1 august it can be 1 again etc etc
Is there a framework function for it or do i have to calculate it myself?
Michel
You need to know:
TimeZoneInfofrom .NET 3.5, bearing in mind that one country can have several time zones)DateTimeor aDateTimeOffset.At that point it’s relatively easy: convert the UTC instant into the local time in both time zones using
TimeZoneInfo.ConvertTime, and subtract one from the other. Alternatively, useTimeZoneInfo.GetUtcOffsetfor both of them, and subtract one offset from the other.Here’s an example to find the current difference between London and Mountain View: