views:

881

answers:

1

I have a string, which contains a timestamp (yyyy-mm-dd hh:mm:ss). I can create a CultureInfo object based on other information I get. Therefore I know which country the timestamp is in. The timestamp is not in UTC/GMT.

Say the timestamp is from Indonesia (new CultureInfo("id-ID")), meaning the string was created by DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") or similar. That means the string contains the local time in Indonesia. I know my timezone, but I don't know how to convert the Indonesian time to UTC/GMT, so I can use the UTC/GMT object in TimeZoneInfo. My own timezone may or may not be in the same timezone.

Is there anywhere, this information is connected?

CultureInfo has a lot of properties, surely some of them can be used to get timezone, somwhere?

I might add that I find the entire system very confusing, so I could be way off in how I think things works.

+5  A: 

Short answer: No

Long Answer: This is a 1 to many relationship between culture and timezone. For example: en-US - English, American contains 6 timezones... so how would you get from en-US to Eastern Daylight time? ... and how do you get the daylight savings time offsets?

It's a confusing cultural conundrum (wow, try saying that 5 times fast) that is not easily solvable with the CLR.

Jeff Fritz
No I noticed pretty much immediately that this would be a challenge.I've googled about abit, and I found this wiki [Time zones by country](http://en.wikipedia.org/wiki/Time_zones_by_country). There are not that many countries with that many timezones. *Australia, Brazil, Canada, France, Indonesia (heh), Mexico, New Zealand, Russia (!), UK, USA +-*Now using that as a datasource, and defaulting to the capital city's timezone for the countries with lots of tz, It goes along way.Just airing my idea here.
CS