Created
August 22, 2014 09:23
-
-
Save kanakiyajay/342f44d75ef6d86933cb to your computer and use it in GitHub Desktop.
Get pretty timestamp in javascript
This file contains 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 getTimeStamp() { | |
var now = new Date(); | |
return ((now.getMonth() + 1) + '/' + | |
(now.getDate()) + '/' + | |
now.getFullYear() + " " + | |
now.getHours() + ':' + | |
((now.getMinutes() < 10) | |
? ("0" + now.getMinutes()) | |
: (now.getMinutes())) + ':' + | |
((now.getSeconds() < 10) | |
? ("0" + now.getSeconds()) | |
: (now.getSeconds()))); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment