Find Local Time From UCT Time
-
Hi to all, In my table there is a coloum CreatedDate(DateTime) which stores datetime in UCT Time. Now I want to show this time to user's local time.(i.e. User From US can see US time, User from india can see Indian local time.) how can i convert? should i have go through Cultureinfo? or may it creates daylight saving problem? Thanks in advance.
!- F - R - I - E - N - D - S -!
-
Hi to all, In my table there is a coloum CreatedDate(DateTime) which stores datetime in UCT Time. Now I want to show this time to user's local time.(i.e. User From US can see US time, User from india can see Indian local time.) how can i convert? should i have go through Cultureinfo? or may it creates daylight saving problem? Thanks in advance.
!- F - R - I - E - N - D - S -!
The following code only works with .NET 3.5 or higher.
TimeZoneInfo cstZone = TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time"); DateTime cstTime = TimeZoneInfo.ConvertTimeFromUtc(timeUtc, cstZone);
To enumerate all known timezones use:
ReadOnlyCollection<TimeZoneInfo> zones = TimeZoneInfo.GetSystemTimeZones();
[edit] modified the enumerate statement
Greetings Covean
-
The following code only works with .NET 3.5 or higher.
TimeZoneInfo cstZone = TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time"); DateTime cstTime = TimeZoneInfo.ConvertTimeFromUtc(timeUtc, cstZone);
To enumerate all known timezones use:
ReadOnlyCollection<TimeZoneInfo> zones = TimeZoneInfo.GetSystemTimeZones();
[edit] modified the enumerate statement
Greetings Covean
Thanks for reply. but , I don't have users time zone right now. This thing i have to implement on Live site containing around 10000 users. How can i know user local time / time zone using cs file not using not a javascript.
!- F - R - I - E - N - D - S -!
-
Thanks for reply. but , I don't have users time zone right now. This thing i have to implement on Live site containing around 10000 users. How can i know user local time / time zone using cs file not using not a javascript.
!- F - R - I - E - N - D - S -!