Created
November 16, 2013 09:12
-
-
Save ZellSnippets/7497915 to your computer and use it in GitHub Desktop.
JS: Getting date objects
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 current = new Date(), | |
day = current.getDate(), | |
month = current.getMonth(), | |
year = current.getFullYear(); | |
/** | |
* Converting to and from milliseconds. | |
*/ | |
// Converting to: | |
var current = new Date(); | |
var ms = Date.parse(current); | |
// Converting from: | |
var date = new Date(ms).toString(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment