The code: new Date('2011-12-15 00:00:00') is showing as NaN.
How can I convert this date?
Any helps are appreciated.
My code is very straight forward. It works in Chrome but not in IE 9.
var dateText = new Date('2012-08-01 00:00:00');
alert(dateText.getDate().toString() + "/" + dateText.getMonth().toString() + "/" + dateText.getYear().toString());
After some search in web, realized that the stupid IE does not understand this date format. I do not know about Safari and Firefox, but certainly this works in Chrome.
Either I will have to use some javascript libraries like DateJS for doing this or will have to do some custom coding as below which I will never recommend. Fortunately in my case, I am sure that I will be getting the dates in the YYYY-MM-DD HH:MI:SS format.