You can try converting the date to epoch instead and then converting it back to a date (on my iPhone so please excuse any mistakes and psuedo code):
var date = +new Date() // save it in redis // retrieve from redis var date = new Date(redis_date) I believe that should work. --- dale On Mar 20, 2012, at 10:11 AM, Matt <hel...@gmail.com> wrote: > 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 <msc...@gmail.com> wrote: > On Mar 20, 3:42 am, Angelo Chen <angelochen...@gmail.com> 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 nodejs@googlegroups.com > To unsubscribe from this group, send email to > nodejs+unsubscr...@googlegroups.com > 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 nodejs@googlegroups.com > To unsubscribe from this group, send email to > nodejs+unsubscr...@googlegroups.com > 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 nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en