dateformat
A node.js package for Steven Levithan's excellent dateFormat() function.
Modifications
- Removed the
Date.prototype.format
method. Sorry folks, but extending native prototypes is for suckers. - Added a
module.exports = dateFormat;
statement at the bottom - Added the placeholder
N
to get the ISO 8601 numeric representation of the day of the week
Installation
$ npm install dateformat
Usage
As taken from Steven's post, modified to match the Modifications listed above:
var dateFormat = require('dateformat');
var now = new Date();
dateFormat(now, "dddd, mmmm dS, yyyy, h:MM:ss TT");
dateFormat(now, "isoDateTime");
dateFormat.masks.hammerTime = 'HH:MM! "Can\'t touch this!"';
dateFormat(now, "hammerTime");
dateFormat("Jun 9 2007", "fullDate");
dateFormat(now);
dateFormat();
dateFormat("longTime");
dateFormat(now, "longTime", true);
dateFormat(now, "UTC:h:MM:ss TT Z");
dateFormat(now, "W");
dateFormat(now,"N");
License
(c) 2007-2009 Steven Levithan stevenlevithan.com, MIT license.