Results 1 to 3 of 3

Thread: convert between timzones?

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2010
    Posts
    6

    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

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,350

    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.

  3. #3

    Thread Starter
    New Member
    Join Date
    Aug 2010
    Posts
    6

    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
  •  



Click Here to Expand Forum to Full Width