眼眸繁星
原生写法 (也许你们很少研究date对象) function formatDate() {
var today = new Date();
return today.toLocaleString("zh-Hans-CN", {
// timeZone: ['UTC'],
weekday: "long",
hour12: false,
year: "numeric",
month: "2-digit",
day: "2-digit",
hour: "2-digit",
minute: "2-digit",
second: "2-digit"
});
}输出2018年06月27日星期三 10:09:19 function showingExpirationDate() {
var today = new Date();
return today.toISOString().substring(0,10)+ ' '+today.toTimeString().substring(0,9);
}输出 2018-06-27 10:07:02