Search code examples
c#javascriptajaxdatetimedatejs

DateJS parse datetime issue


I'm currently have the datetime format like this:

2012-10-11T00:00:00Z

and it looks like datejs is not happy with the trailing 'z'.

in the request, i just use

"\/Date(" + new Date(2012-10-11T00:00:00).getTime() + ")\/";

to make it as a json required format, but when it comes back from the response(c# backend), 'z' is automatically added. Is there any way to get rid of it or make the datejs be able to parse this format?


Solution

  • Update

    Checkout moment.js, It has solved many common issues regarding datetime in javascript.

    A 5kb javascript date library for parsing, validating, manipulating, and formatting dates.