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. Get DateTime according to country.

Get DateTime according to country.

Scheduled Pinned Locked Moved ASP.NET
questionsysadminhelp
6 Posts 3 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
    Avinash_Mane
    wrote on last edited by
    #1

    Hello, I have hosted my website on server is lying in USA. I have used system.Datetime.Now() for date operations, whereas my clients are from india and it shows me around 12 hours difference. How can i map this time zone? I don't want to store the client's machine time but only server end time. Please help me. waiting for your prompt reply. Thanks.

    S S 2 Replies Last reply
    0
    • A Avinash_Mane

      Hello, I have hosted my website on server is lying in USA. I have used system.Datetime.Now() for date operations, whereas my clients are from india and it shows me around 12 hours difference. How can i map this time zone? I don't want to store the client's machine time but only server end time. Please help me. waiting for your prompt reply. Thanks.

      S Offline
      S Offline
      Shahriar Iqbal Chowdhury Galib
      wrote on last edited by
      #2

      hi, You can use DateTime.Now.ToUniversalTime()

      A 1 Reply Last reply
      0
      • S Shahriar Iqbal Chowdhury Galib

        hi, You can use DateTime.Now.ToUniversalTime()

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

        Thanks for your reply sir. DateTime.Now.ToUniversalTime() returns UTC datetime. How can i get the india's datetime from this. Please help me.

        S 1 Reply Last reply
        0
        • A Avinash_Mane

          Thanks for your reply sir. DateTime.Now.ToUniversalTime() returns UTC datetime. How can i get the india's datetime from this. Please help me.

          S Offline
          S Offline
          Shahriar Iqbal Chowdhury Galib
          wrote on last edited by
          #4

          hi, Please refer to the link below http://forums.asp.net/p/813670/813709.aspx[^]

          A 1 Reply Last reply
          0
          • S Shahriar Iqbal Chowdhury Galib

            hi, Please refer to the link below http://forums.asp.net/p/813670/813709.aspx[^]

            A Offline
            A Offline
            Avinash_Mane
            wrote on last edited by
            #5

            hello, i have referred that link but i am not able to get exact idea from it.

            1 Reply Last reply
            0
            • A Avinash_Mane

              Hello, I have hosted my website on server is lying in USA. I have used system.Datetime.Now() for date operations, whereas my clients are from india and it shows me around 12 hours difference. How can i map this time zone? I don't want to store the client's machine time but only server end time. Please help me. waiting for your prompt reply. Thanks.

              S Offline
              S Offline
              sashidhar
              wrote on last edited by
              #6

              You can Convert the date time from us format to indian format by converting to utc and adding the hrs. OR Use Javascript to get the client time

              var localTime = new Date();
              var hours = localTime .getHours();
              var minutes = localTime .getMinutes();
              var seconds = localTime .getSeconds();

              I think It can be done using culture i never used it try the below link similar post..! http://relatedterms.com/thread/1394580/Date%20%20%20Time%20issues%20with%20different%20timezones%20for%20server%20%20%20client[^]

              LatestArticle :Log4Net Why Do Some People Forget To Mark as Answer .If It Helps.

              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