Created
April 18, 2019 08:20
-
-
Save lilywang711/23bc14b2c399c465161c712b0d1b0ccb to your computer and use it in GitHub Desktop.
格式化日期
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 time(time = +new Date()) { | |
var date = new Date(time + 8 * 3600 * 1000); | |
return date.toJSON().substr(0, 19).replace('T', ' '); | |
} | |
time(); // "2019-04-18 16:20:22" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment