Created
January 2, 2014 10:49
-
-
Save lukehedger/8217558 to your computer and use it in GitHub Desktop.
Add leading zeros (to months etc)
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
now = Date.now() | |
date = new Date(now) | |
m = ('0'+(date.getMonth()+1)).slice(-2) // add leading zero to month |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment