This file contains hidden or 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
| // 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 |
This file contains hidden or 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
| // 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() |