Last active
August 31, 2017 03:44
-
-
Save objectfoo/afd460ab0b8402638fa9 to your computer and use it in GitHub Desktop.
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 pad(n) { | |
| return n < 10 ? '0' + n.toString(10) : n.toString(10); | |
| } | |
| var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', | |
| 'Oct', 'Nov', 'Dec']; | |
| // 26 Feb 16:19:34 | |
| function timestamp() { | |
| var d = new Date(); | |
| var time = [pad(d.getHours()), | |
| pad(d.getMinutes()), | |
| pad(d.getSeconds())].join(':'); | |
| return [d.getDate(), months[d.getMonth()], time].join(' '); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment