Last active
October 24, 2018 13:30
-
-
Save mose/9108728 to your computer and use it in GitHub Desktop.
Backtick bookmarklet for transforming unix timestamp to human date.
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 unix_timestamp = window.prompt("Input a timestamp (ie. 1392879315)", ""); | |
var date = new Date(unix_timestamp*1000); | |
var utcDate = date.getUTCFullYear() + '-' + (date.getUTCMonth()+1) + '-' + date.getUTCDate() + ' ' + date.getUTCHours() + ':' + date.getUTCMinutes() + ':' + date.getUTCSeconds(); | |
var localDate = date.getFullYear() + '-' + (date.getMonth()+1) + '-' + date.getDate() + ' ' + date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds(); | |
window.alert("\nUTC: "+utcDate+"\nLocal: "+localDate); |
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
{ | |
"name": "Timestamp from unix", | |
"description": "For transforming unix timestamp to human date in UTC and local." | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment