I know very little about Javascript..
It's for a countdown script.
As far as I can tell, the javascript gets the 'today date and time' somehow (from the user's system).
But I want to modify it so that it gets the server time (using php date).
So I'll need to create a php variable and then add it to the javascript.(?) How do I do this?
here's some of the script:
Sou you can see that td is the current date (today) and that endDate is the target date we are counting down to. The var. dd is the result between the subtraction of endDate by td, which gives us the time left.
It's for a countdown script.
As far as I can tell, the javascript gets the 'today date and time' somehow (from the user's system).
But I want to modify it so that it gets the server time (using php date).
So I'll need to create a php variable and then add it to the javascript.(?) How do I do this?
here's some of the script:
Code:
function countdown(yr, mo, da, deadlineHr, minute){ var montharray = new Array("ene","feb","mar","abr","may","jun","jul","ago","sep","oct","nov","dic"); //deportes should be passing in UTC times, daylight savings not accurate for non-us var UTCDeadlineHr = deadlineHr; var UTCMilliseconds = 1000 * 60 * 60 * UTCDeadlineHr; var today = new Date(); var todayy = today.getUTCFullYear(); if (todayy < 1000) todayy+=1900; var todaym = today.getUTCMonth(); var todayd = today.getUTCDate(); var todayh = today.getUTCHours(); var todaymin = today.getUTCMinutes(); var todaysec = today.getUTCSeconds(); td= new Date(Date.UTC(todayy, todaym, todayd, todayh, todaymin, todaysec)); endDate = new Date(Date.UTC(yr, mo-1, da, deadlineHr, minute, 0)); var dd = (endDate - td);
Comment