I have an issue with date.In my Model class I have used DateTime property(I used Code First), for transferring json data from action to another action I use Jquery ($.ajax), my date convert in this format, I think it milliseconds:
/Date(1188594000000)/
I tryed to convert it using js, not working:
var date = new Date(mydate);
/Date(1188594000000)/
is a string and the long numbers inside the brackets are the milliseconds since the beginning of the unix epoch time. You cannot pass that(the string as it is) toDate
constructor. If you want to generate a datetime object from that value, you should remove the first 6 characters (/Date(
) and pass the milliseconds onlyThe statement
mydate.substr(6)
will return a string value like"1188594000000)/"
and passing this to parseInt method returns the number1188594000000
which can be safely passed to the Date constructor.