Created
February 21, 2012 20:09
-
-
Save cfurrow/1878576 to your computer and use it in GitHub Desktop.
Moment.js examples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var now = moment(); | |
console.log(now.format('dddd, MMMM Do YYYY, h:mm:ss a')); // => Tuesday, February 21st 2012, 3:03:51 pm | |
var halloween = moment([2011, 9, 31]); // September 31st | |
console.log(halloween.fromNow()); // 4 months ago | |
var now = moment().add('days', 9); | |
console.log(now.format('dddd, MMMM Do YYYY')); // Thursday, March 1st 2012 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment