I have an object containing a javacsript date. Something like this:
var obj = {
startTime: new Date()
....
}
When Angularjs converts the object to JSON (for example, when sending it over $http), it converts the date to a string such as:
2015-12-20T15:35:15.853Z
I would like to have a timestamp instead of this string. What is the best way to achieve this?
timestamp
? JSON is a string-based notation. It must serialize it to a string in some format. Do you want a different format? ISO 8601 is the default.