I get a date back from rails that looks like: "2010-10-29T00:00:00+00:00"
And I'd like to convert a javascript date created by 'new Date()' to that format. Is there an easy way?
I get a date back from rails that looks like: "2010-10-29T00:00:00+00:00"
And I'd like to convert a javascript date created by 'new Date()' to that format. Is there an easy way?
using dateformat you can format date as you want
TRY these
http://blog.stevenlevithan.com/archives/date-time-format
Looks like you're trying to parse an ISO8601 date string. A quick google search returned a function at dansnetwork.com that claims to be able to parse ISO8601 strings into Date
objects. Or you could try parsing it yourself (Check out String.split(), and the Date api.). Luckily for you, I believe I read somewhere that Mozilla's Javascript 1.8.5 is going to support ISO8601 strings in its native parse()
function. Hopefully the rest will follow suit shortly.
You're looking for ISO 8601 format.
I've always been fond of the Date.js Library for any date manipulation/formatting in JS.
you can use the the toISOString() method to get this format