Also you can skip the .parse() part in that (although it's done internally,
obviously):

> var d = new Date();
undefined
> d
Tue, 20 Mar 2012 14:09:58 GMT
> new Date(d.toISOString());
Tue, 20 Mar 2012 14:09:58 GMT




On Tue, Mar 20, 2012 at 3:59 AM, mscdex <[email protected]> wrote:

> On Mar 20, 3:42 am, Angelo Chen <[email protected]> wrote:
> > tried var d = new Date()
> > s = d.toISOString()
> > it saves as a string, but Date.parse(s) seems not converting it back
> > correctly, any hints?
>
> Date.parse returns a unix timestamp, so you need `new Date(s)` to get
> an actual Date object.
>
> This works for me with v0.6.13:
>
> > var d = new Date()
> undefined
> > d
> Tue, 20 Mar 2012 07:57:16 GMT
> > Date.parse(d.toISOString())
> 1332230236333
> > new Date(Date.parse(d.toISOString()))
> Tue, 20 Mar 2012 07:57:16 GMT
>
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to