Created
March 15, 2018 08:55
-
-
Save EtherDream/90540b477c556b4156f6f5bf1cf99564 to your computer and use it in GitHub Desktop.
date object -> "yyyy/MM/dd hh/mm/ss"
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 formatTime(date) { | |
var d = new Date(date - 60000 * date.getTimezoneOffset()); | |
var s = d.toISOString(); | |
return s.substr(0, 10) + ' ' + s.substr(11, 18); | |
} | |
formatTime( new Date() ); // "2018-03-15 16:52:34.969Z" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment