Get the local time from a web app?

  1. 4 months ago

    Allan U

    Nov 8 New Zealand

    Is it possible to have a web app get/record the users local time (i.e. form their browser), as opposed to the current time on the server that the web app is running on?

    I want to know what the users time is NOW, so that when they enter the time at which they want to receive a specific email, I can calculate when that email should be sent from the server machine to reach them at the correct time in their timezone.


  2. Ralph A

    Nov 8 Santa Monica, California

    Dim d As New Date
    d.GMTOffset = Session.GMTOffset
  3. Allan U

    Nov 8 New Zealand

    Thanks Ralph, but as far as I can ascertain at the moment, GMTOffset will return the offset of the current time on the SERVER that the Web App is running on, not the offset of the time as it is currently on the users BROWSER (which may been in a completely different country/timezone to the server machine).

    I am happy to admit that I may be missing something here....

  4. Wayne G

    Nov 8 Pre-Release Testers, Xojo Pro Answer New Zealand

  5. Allan U

    Nov 8 New Zealand

    Wayne -- thanks very much for pointing that out -- much appreciated! :-)

  6. Ralph A

    Nov 8 Santa Monica, California

    Oy. I never noticed that. Luckily all my Web app clients are California, and so is the server i use. Sorry about that.

  7. Greg O

    Nov 10 Xojo Inc

    Just keep in mind that if the user’s clock is wrong, so is that property.

or Sign Up to reply!