reg UTC\GMT time calculation.

Last post 05-08-2008 9:26 PM by SGWellens. 4 replies.

Sort Posts:

  • reg UTC\GMT time calculation.

    05-08-2008, 11:53 AM

    Dear all,

               Is there an API in .net framework to calculate UTC\GMT time, given a datetime & time zone as input ?
    If we do a manual calculation of an UTC\ GMT time, so many parameters(like day light savings) have to be checked.
    so, is there an .net api to do this?

    Thanks in advance

    Prince D 

  • Re: reg UTC\GMT time calculation.

    05-08-2008, 12:41 PM
    • Loading...
    • Svante
    • Joined on 02-12-2007, 12:15 PM
    • Stockholm, Sweden
    • Posts 1,581
    • Moderator

    For the current (i.e. the servers) time zone, you can use the System.TimeZone.CurrentTimeZone property. I'm not sure if there's any built-in support for handling arbitrary timezones, but I did find this library (not tested): http://www.crankedup.com/code/#timezone .

    Svante
    AxCrypt - Free Open Source File Encryption & Online Password Manager - http://www.axantum.com
    [Disclaimer: Code snippets usually uncompiled, beware typos.]
    ______
    Don't forget to click "Mark as Answer" on the post(s) that helped you.
  • Re: reg UTC\GMT time calculation.

    05-08-2008, 3:27 PM
    • Loading...
    • rjcox
    • Joined on 12-19-2007, 2:14 PM
    • Basingstoke, UK
    • Posts 872

    Svante:
    I'm not sure if there's any built-in support for handling arbitrary timezones
     

    Once you have 2.0 SP1 there is.

    System.DateTimeOffset (DateTime with timezone) and  System.TimeZoneInfo have been added.

    Richard
  • Re: reg UTC\GMT time calculation.

    05-08-2008, 4:01 PM
    • Loading...
    • Svante
    • Joined on 02-12-2007, 12:15 PM
    • Stockholm, Sweden
    • Posts 1,581
    • Moderator

    rjcox:

    Once you have 2.0 SP1 there is.

    System.DateTimeOffset (DateTime with timezone) and  System.TimeZoneInfo have been added.

    Cool! Finally. Thank you for pointing this out.

    Svante
    AxCrypt - Free Open Source File Encryption & Online Password Manager - http://www.axantum.com
    [Disclaimer: Code snippets usually uncompiled, beware typos.]
    ______
    Don't forget to click "Mark as Answer" on the post(s) that helped you.
  • Re: reg UTC\GMT time calculation.

    05-08-2008, 9:26 PM
    • Loading...
    • SGWellens
    • Joined on 01-02-2007, 9:27 PM
    • MN, USA
    • Posts 2,286
    • Moderator
      TrustedFriends-MVPs

    rjcox:

    Once you have 2.0 SP1 there is.

    You need .Net 3.5 for that.  

    It's worth upgrading for that feature alone (TimeZoneInfo)

    Steve Wellens
Page 1 of 1 (5 items)