Last active
December 14, 2015 23:09
-
-
Save michaelminter/5163293 to your computer and use it in GitHub Desktop.
Create a millisecond timestamp in Javascript
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
| // create timestamp with milliseconds for unique id | |
| var date = new Date(); | |
| var components = [ | |
| date.getYear(), | |
| date.getMonth(), | |
| date.getDate(), | |
| date.getHours(), | |
| date.getMinutes(), | |
| date.getSeconds(), | |
| date.getMilliseconds() | |
| ]; | |
| var timestamp = components.join(""); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment