Created
April 19, 2013 09:34
-
-
Save trastle/5419236 to your computer and use it in GitHub Desktop.
Timestamp in JS (yuk)
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
function timeStamp() { | |
var d = new Date(); | |
var hour = ('0' + d.getHours()).slice(-2); | |
var min = ('0' + d.getMinutes()).slice(-2); | |
var sec = ('0' + d.getSeconds()).slice(-2); | |
var mil = ('000' + d.getMilliseconds()).slice(-3); | |
return hour + ":" + min + ":" + sec + "(" + mil + ")"; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment