Created
February 4, 2018 08:01
-
-
Save alechko/ec2f538267465a7c906665b6c3a8b981 to your computer and use it in GitHub Desktop.
JS Timestamp for console log
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
var now = new Date(); | |
var h = now.getHours(); | |
h = h > 9 ? h : '0'+h; | |
var m = now.getMinutes(); | |
m = m > 9 ? m : '0'+m; | |
var s = now.getSeconds(); | |
s = s > 9 ? s : '0'+s; | |
var ms = now.getMilliseconds(); | |
n = '['+h+':'+m+':'+s+'.'+ms+'] '+n; | |
console.log(n,item); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment