convert between timzones?
Hi
I need to parse a string with time info from one timezone
and output as another string with the time info for another
timezone.
ex. "19880311 23:44:35 Moscow" > "yyyyMMdd HH:mm:ss NewYork"
it must observe DST, parse the input with format string and
allow output to be formatted with a formatting string
the city names are not important and can be replaced
with f.ex. timezone codes
thank you
and best regards
Re: convert between timzones?
You should look at the TimeZoneInfo class. It can help you convert date and time from one time zone to another. You can use DateTime.TryParseExact to convert the String to a DateTime first.
Re: convert between timzones?
thanks jm, I know about the ParseExact, I have tried this:
Debug.WriteLine(TimeZoneInfo.ConvertTimeBySystemTimeZoneId(dt, TimeZoneInfo.Local.Id, "Pacific Standard Time"))
It works. but
Debug.WriteLine(TimeZoneInfo.ConvertTimeBySystemTimeZoneId(dt, "India Standard Time", "Pacific Standard Time"))
is not working..It seems like I can only convert from local time
br