Skip to content Skip to sidebar Skip to footer

Having Trouble Converting String (parsed From Json) Into Javascript Date Object

I am trying to create javasscript date object in the following way var object = {'name':'Bay Area Global Health Film Festival','start_time':'2013-07-08T19:00:00','end_time':'2013-0

Solution 1:

Try this new Date("2013-07-08T19:00:00"). The time you are gettng seems to be in the required format so there shouldn't be issues.

Solution 2:

It throws an error because js is case sensitive and there is no 'date' object. You should use

var tempDate = newDate(object.start_time);

Solution 3:

In the above code you are not trying to create date object. To create date Object you need to use new.

There are four ways of instantiating a date object.

var d = newDate();
var d = newDate(milliseconds);
var d = newDate(dateString);
var d = newDate(year, month, day, hours, minutes, seconds, milliseconds);

Post a Comment for "Having Trouble Converting String (parsed From Json) Into Javascript Date Object"