Skip to content

Instantly share code, notes, and snippets.

@lilywang711
Created April 18, 2019 08:20
Show Gist options
  • Save lilywang711/23bc14b2c399c465161c712b0d1b0ccb to your computer and use it in GitHub Desktop.
Save lilywang711/23bc14b2c399c465161c712b0d1b0ccb to your computer and use it in GitHub Desktop.
格式化日期
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