Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
146
rated 0 times [  152] [ 6]  / answers: 1 / hits: 50089  / 13 Years ago, mon, january 30, 2012, 12:00:00

I have a web application that has a dynamic javascript calendar, which allows users to set events for a given data and time. I need to push notifications to the users, so I need to convert the date time and timezone they entered, into Eastern Standard Time, so that my notifications are sent out at the correct time.



I would like to do this in javascript, so that when the data time value gets to the php, it's in the right format, before being added to the database.



So to summarize, I need to convert a javascript datatime and timezone, which I get by capturing the users datatime, as a full UTC date, to my servers timezone, which is EST - New York.



Any help or direction on this matter, would be greatly appreciated.
Thanks :)


More From » html

 Answers
10

Pl check this script



function convertToServerTimeZone(){

//EST
offset = -5.0

clientDate = new Date();
utc = clientDate.getTime() + (clientDate.getTimezoneOffset() * 60000);

serverDate = new Date(utc + (3600000*offset));

alert (serverDate.toLocaleString());


}

[#87725] Sunday, January 29, 2012, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
maya

Total Points: 418
Total Questions: 116
Total Answers: 112

Location: Mauritania
Member since Sun, Oct 17, 2021
3 Years ago
;