Convert Javascript Date object to PST time zone

后端 未结 6 1859
野趣味
野趣味 2020-12-06 21:09

I need to pick a future date from calender, suppose the date I am selecting is 10/14/2014, now what I want is to send the date with the time to server, so that

6条回答
  •  旧时难觅i
    2020-12-06 21:51

    Suggest you look at DateJS http://code.google.com/p/datejs/ or http://www.datejs.com/. Handles PDT for you.

    Here is an alternative for you:

    Use: Date.UTC(year, month, day, hours, minutes, seconds, ms)

    Example: For 1 Jan 2013 6AM PST

    var date = new Date(Date.UTC(2013, 0, 1, 14, 0, 0))   
    console.log(date.toUTCString());  
    

    Prints: "Tue, 01 Jan 2013 14:00:00 GMT"

提交回复
热议问题