Skip to content

Instantly share code, notes, and snippets.

View mManishTrivedi's full-sized avatar
🏠
Working from home

Manish Trivedi mManishTrivedi

🏠
Working from home
View GitHub Profile
@mManishTrivedi
mManishTrivedi / moment-js-examples.js
Last active August 25, 2017 06:32
Gist contain examples of moment.js lib
// Do experiment here "http://jsfiddle.net/FLhpq/1958/"
//Query : timestamp (second) to current date
moment.unix(1442555078).calendar();
// output : Today at 11:14 AM
//Query : Timestamp (second) to proper format
moment.unix(1442555078).format('LLLL');
// output : Friday, September 18 2015 11:14 AM
@founddrama
founddrama / moment-in-node.js
Created March 24, 2012 12:53
Moment.js examples
// node:
var moment = require('moment');
moment().add('days', 2).fromNow();
// 'in 2 days'
moment().subtract('days', 2).fromNow();
// '2 days ago'
moment('November 1977').fromNow()