As you can see in the source code, Andre implemented to ECMAScript 5.1
Date.prototype.toJSON method. toJSON just calls the toISOString()
function to retreive the value.
/* Serializes a <code>Date</code> object as a JSON-String
 * as specified in ECMAScript5, chapter 15.9.5.44

5.1 Spec:
> 15.9.5.43 Date.prototype.toISOString ( )
> This function returns a String value represent the instance in time 
> represented by this Date object. The format
> of the String is the Date Time string format defined in 15.9.1.15. All fields 
> are present in the String. The time
> zone is always UTC, denoted by the suffix Z.

var d = new Date();
d.toJSON() returns "2012-03-22T08:36:05.088Z"
d.toISOString() returns "2012-03-22T08:36:05.088Z"
d.toDateString() returns "Thu Mar 22 2012"
d.toLocaleString() returns "Thu Mar 22 2012 09:36:05 GMT+0100 (CET)"
d.getTimezoneOffset() returns -60

You could use the getTimezoneOffset() function to do the calculation
of your local time, though.

- Raju

Reply via email to