Reputation: 21206
I need to know the timezone for a certain language which I get from the current culture info object.
I can not use 3rd party libs like nodatime.
What property of the CultureInfo.CurrentCulture is important when I enumerate through all system time zones and want to get the right timezone?
Upvotes: 2
Views: 3690
Reputation: 6531
If all you've got is culture, that's basically some string like: MX (Spanish Mexico), es-CO (Spanish Columbia), and fr-CA (French Canada)
then you just have to correspond each on of these to a timezone, except no such one to one relationship exists. So no. You can roughly know the timezone (as pointed out in comments), fr-CA is all in the same timezone, but MX is in four (MX isn't enough information to gauge timezone).
So you don't have enough data to know, what can you do. If you need to know their timezone on the server side try geo-location: How can I find a user's GEO Location using ASP.NET?
However, if it's just the web page that needs to know, try putting that logic in the JavaScript which is executing on their machine.
Or you could just... ask them.
Upvotes: 4