There have been snippets of code floating around the net for ages, and various libraries that include necessary support. rfc3339date.js is my attempt at rolling the best into an standalone, unobtrusive, and open-sourced Date extension that plays well with other libraries that also extend the Date class.
It lets you do things like:
var d = Date.parse( "2010-07-20T15:00:00.333Z" );
d.toRFC3339UTCString();
=> "2010-07-20T15:00:00.333Z"
d.toRFC3339UTCString(true);
=> "20100720T150000.333Z"
d.toRFC3339LocaleString(true);
=> "20100720T230000.333+0800" // assuming current timezone is GMT+8
The readme in the project repository on github has more information about the range of date formats supported and other methods available.
Blogarhythm: Too Many Times - Mental as Anything
No comments:
Post a Comment