Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Find Local Time From UCT Time

Find Local Time From UCT Time

Scheduled Pinned Locked Moved ASP.NET
questionhelp
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    adkalavadia
    wrote on last edited by
    #1

    Hi to all, In my table there is a coloum CreatedDate(DateTime) which stores datetime in UCT Time. Now I want to show this time to user's local time.(i.e. User From US can see US time, User from india can see Indian local time.) how can i convert? should i have go through Cultureinfo? or may it creates daylight saving problem? Thanks in advance.

    !- F - R - I - E - N - D - S -!

    C 1 Reply Last reply
    0
    • A adkalavadia

      Hi to all, In my table there is a coloum CreatedDate(DateTime) which stores datetime in UCT Time. Now I want to show this time to user's local time.(i.e. User From US can see US time, User from india can see Indian local time.) how can i convert? should i have go through Cultureinfo? or may it creates daylight saving problem? Thanks in advance.

      !- F - R - I - E - N - D - S -!

      C Offline
      C Offline
      Covean
      wrote on last edited by
      #2

      The following code only works with .NET 3.5 or higher.

      TimeZoneInfo cstZone = TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time");
      DateTime cstTime = TimeZoneInfo.ConvertTimeFromUtc(timeUtc, cstZone);
      

      To enumerate all known timezones use:

      ReadOnlyCollection<TimeZoneInfo> zones = TimeZoneInfo.GetSystemTimeZones();

      [edit] modified the enumerate statement

      Greetings Covean

      A 1 Reply Last reply
      0
      • C Covean

        The following code only works with .NET 3.5 or higher.

        TimeZoneInfo cstZone = TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time");
        DateTime cstTime = TimeZoneInfo.ConvertTimeFromUtc(timeUtc, cstZone);
        

        To enumerate all known timezones use:

        ReadOnlyCollection<TimeZoneInfo> zones = TimeZoneInfo.GetSystemTimeZones();

        [edit] modified the enumerate statement

        Greetings Covean

        A Offline
        A Offline
        adkalavadia
        wrote on last edited by
        #3

        Thanks for reply. but , I don't have users time zone right now. This thing i have to implement on Live site containing around 10000 users. How can i know user local time / time zone using cs file not using not a javascript.

        !- F - R - I - E - N - D - S -!

        C 1 Reply Last reply
        0
        • A adkalavadia

          Thanks for reply. but , I don't have users time zone right now. This thing i have to implement on Live site containing around 10000 users. How can i know user local time / time zone using cs file not using not a javascript.

          !- F - R - I - E - N - D - S -!

          C Offline
          C Offline
          Covean
          wrote on last edited by
          #4

          Ever tried to look if you can use some data delivered by the HttpRequest? I hope this can help you.

          Greetings Covean

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups