Javascript timer not working when php gives it a date

Okay since I am not to familiar with javascript I had php spit out a date if it matches certain criteria. I stored the date in a session variable so that it wouldnt be lost on a refresh, as I know php variables lose their value when the page is refreshed. I declared a variable with a stactic date to see if the date is being fed to the javascript timer. It is not reaching the timer. I tested with an alert to see if it was being fed to javascript and sure enough it is. No errors in the console. I thought maybe it was the fact that javascript counts dates 0-11 instead of 1-12 like php does, and I accounted for that and no change. All I see is the text that gets rendered when timer is done counting down.

Basically the date is not reaching this block:

window.onload=function(){
  var cdown = new CDown();

  cdown.add(new Date(CountDownDate), "countbox1");
};

I have no idea how to fix the javascript so that date does reach that block. I tried putting that static date in the block and still no change, but if I change CountDownDate to a static string then it works like a charm.

Answers


Wow the fix was sooo simple....

I looked up date object on w3schools and tested my format and it didnt work. I was using this format for dates:

yyyy,mm,dd,hh,mm,ss

I know the above format is in fact valid, because I have seen it used in tutorials before, but when I used the following format it worked like a charm:

yyyy mm dd hh:mm:ss

The one thing I dont get is that I wasnt getting no errors in the console when I used the first format. I guess the first format doesnt work when it is in a variable.


Need Your Help

Checking User's role in Google appengine

java google-app-engine

Need to check if the logged in user is a Developer, Owner or Viewer in google appengine in java.

Server Management - Need script to monitor free space on server

windows powershell

Need script to monitor free space on server and if the free memory space goes done certain threshold send alert mail.