uswebpro9
asked on
Get Time difference between 2 TimeZones
Hello,
I am trying to get the time difference between the server and the client.
Is this the best way to do it? I think my "TimeSpan totalTimeDifference" part is not right.
thanks
I am trying to get the time difference between the server and the client.
Is this the best way to do it? I think my "TimeSpan totalTimeDifference" part is not right.
thanks
private double GetServerClientTimeDiff(string ClientTimeZoneId)
{
// Get the local time zone and the current local time and year.
TimeZoneInfo clientZone = TimeZoneInfo.FindSystemTimeZoneById(ClientTimeZoneId);
// What is the total difference between server and clients in minutes
TimeSpan totalTimeDifference = TimeZone.CurrentTimeZone.GetUtcOffset(System.DateTime.Now).Add(clientZone.BaseUtcOffset);
return totalTimeDifference.TotalMinutes;
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I assume that this "problem" is solved ?
Don't you get the result that you want ?