-
Feb 9th, 2011, 05:22 PM
#1
Thread Starter
New Member
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
-
Feb 9th, 2011, 06:07 PM
#2
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.
-
Feb 9th, 2011, 06:59 PM
#3
Thread Starter
New Member
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
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|