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