标签: javascript date formatting
Hello when i try to convert my date to format UTC it throwing TypeError: date.toUTCString it's not a function any suggestions?
答案 0 :(得分:2)
正如DontVoteMeDown所说:Date.now()不返回日期对象,而是Date.now()返回自1970年1月1日00:00:00 UTC以来经过的毫秒数。
将当前时间戳作为Date对象
var date = new Date( Date.now() );
或更简单(但不太可读)
var date = new Date();