Skip to content

Instantly share code, notes, and snippets.

@cfurrow
Created February 21, 2012 20:09
Show Gist options
  • Save cfurrow/1878576 to your computer and use it in GitHub Desktop.
Save cfurrow/1878576 to your computer and use it in GitHub Desktop.
Moment.js examples
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