/**
* 格式化UTC格式的日期
* 返回格式:2018-04-12 07:22:36
*/
function fmtDate(date) {
var dateee = new Date(date).toJSON();
return new Date(+new Date(dateee) + 8 * 3600 * 1000).toISOString().replace(/T/g, ' ').replace(/\.[\d]{3}Z/, '');
}
本文介绍了一个用于格式化UTC格式日期的JavaScript函数,该函数能够将输入的UTC日期转换为特定格式,例如'2018-04-1207:22:36'。
/**
* 格式化UTC格式的日期
* 返回格式:2018-04-12 07:22:36
*/
function fmtDate(date) {
var dateee = new Date(date).toJSON();
return new Date(+new Date(dateee) + 8 * 3600 * 1000).toISOString().replace(/T/g, ' ').replace(/\.[\d]{3}Z/, '');
}
1002
2万+

被折叠的 条评论
为什么被折叠?