1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Help needed - JS app. From local machine time to UTC

Discussion in 'HTML & JavaScript' started by Gary Carlyle, Jun 20, 2015.

  1. Gary Carlyle

    Gary Carlyle Regular Member

    Joined:
    Aug 27, 2010
    Messages:
    262
    Likes Received:
    46
    Home Page:
    Hi,

    I have a JS app. Its a TV guide but instead of displaying results in the client based on their Windows time I want to display results for the them based on UTC time.

    I can code in PHP but I'm clueless with JS.

    Help please if you can.
     
  2. sousatg

    sousatg Newbie

    Joined:
    Feb 11, 2015
    Messages:
    7
    Likes Received:
    0
    Hello Gary. I would love to help you out with the JS code. PM me if you would like me help.
     
  3. MrBlue

    MrBlue Senior Member

    Joined:
    Dec 18, 2009
    Messages:
    974
    Likes Received:
    680
    Occupation:
    Web/Bot Developer
    Take a look at MomentJS
    Code:
    http://momentjs.com/timezone/
     
  4. delite737

    delite737 Registered Member

    Joined:
    Nov 1, 2013
    Messages:
    70
    Likes Received:
    11
    Code:
    function timezone() {
      var myTime= new Date()
        var offset = myTime.getTimezoneOffset();
    offset=  offset * 60000
    offset=offset+myTime.getTime()
    UTCTime= new Date(offset)
    return UTCTime.getHours()+":"+UTCTime.getMinutes()+":"+UTCTime.getSeconds()
     
     
     
    }
    
     
    Last edited: Sep 5, 2015