SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Sep 2010
    Posts
    131
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Local time of the local computer

    I would like to be able to get the local time of the local computer using Javascript Date class.

    var tz = new Date().getTimezoneOffset();

    Gives you timezone.

    How would I get local time?

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,152
    Mentioned
    190 Post(s)
    Tagged
    2 Thread(s)
    The Date object has a lot of methods https://developer.mozilla.org/en-US/...l_Objects/Date
    You should be able to do just about anything you need with those - except -
    you can get server time and computer time, but they are only as correct as they are on the server or computer.
    That is, if the computer time is wrong, you won't get the correct "local" time.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •