Like DateTime.Now
gives us current date and time with respect to current system.
How can we find Current Time
of different culture i.e different timezone using c# asp.net???
I find SystemTimeToTzSpecificLocalTime Function
but how can i used this one???
Asked
Active
Viewed 1,674 times
0

Neo
- 15,491
- 59
- 215
- 405
-
possible answer here http://stackoverflow.com/questions/832986/how-to-work-with-timezone-in-asp-net – Tim B James Aug 26 '11 at 15:04
2 Answers
3
If you're using .NET 3.5 or later, you can use TimeZoneInfo
:
TimeZoneInfo otherZone = ...;
DateTime otherZoneTimeNow = TimeZoneInfo.ConvertTime(DateTime.UtcNow, otherZone);
You need to be somewhat careful using TimeZoneInfo
- different DateTime
"kinds" do different things - you should read the docs for any call you make carefully. (I recently blogged about the problems with DateTime
... TimeZoneInfo
basically has to handle the ambiguity.)

Jon Skeet
- 1,421,763
- 867
- 9,128
- 9,194
-
1@Jon Skeet: Can you actually use this to get the exact (or almost exact) time in another time zone? If so, what criteria is needed to get the time - in this case, let's say from Massachusetts (EST) to London (GMT) (Is it GMT or GMT + 1??) – James Johnson Aug 26 '11 at 15:08
-
@James: What do you mean by "what criteria"? You just need to get the right TimeZoneInfo (e.g. by ID) and convert. And yes, TimeZoneInfo deals with daylight saving. – Jon Skeet Aug 26 '11 at 15:16
-
@Jon Skeet: What I'm wondering is how to get the ID of the time zone when all you have is an address. Say I'm in Massachussetts and I want to know the local time at an address in Tucson, Arizona - is there any way of doing that without having some geographic information stored in a database or doing a lookup through an API? TimeZoneInfo would work once you know the time zone, but what if you don't know the time zone beforehand? – James Johnson Aug 26 '11 at 15:34
-
@James: That's a very different question. There are various web services to give you that information, but it's usually in terms of the Olson zone ID. At that point you need Noda Time :) – Jon Skeet Aug 26 '11 at 15:36
0
You can use a service, like the Yahoo! Web Services API, to pull this information and more. You can get time zone, local time, population, etc. with the Yahoo! Web Services API. The biggest drawback to that approach is the maximum daily hit count.
You can check out this link for more details:

James Johnson
- 45,496
- 8
- 73
- 110