Created
May 5, 2015 06:59
-
-
Save tianp/06ca62659255b2f955a8 to your computer and use it in GitHub Desktop.
Moment.js Get Today (24 hours) Timeframe Interval
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
var moment = require('moment') | |
// get this midnight and next moment object and convert into unix timestamp | |
// this midnight (1 minute after last midnight) | |
var thisMidnight = moment( moment().format('YYYY-MM-DD') + ' 00:01:00' ).unix() | |
// next midnight (1 minute before next midnight) | |
var nextMidnight = moment( moment().format('YYYY-MM-DD') + ' 23:59:00' ).unix() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment