我尝试将此countdown jQuery script的日期格式从本地时间更改为UTC,但在我更改后无效。我甚至问过,但没有得到答案。
<script>
$(function(){
var note = $('#note'),
ts = new Date.UTC(2012, 0, 1),
$('#countdown').countdown({
timestamp: ts,
callback: function(days, hours, minutes, seconds) {
var message = "";
message += days + " day" + ", ";
message += hours + " hour" + ", ";
message += minutes + " minutes" + " & ";
message += seconds + " seconds" + " <br />";
message += "time left";
note.html(message);
}
});
});
</script>
我改变了这个:
ts = new Date(2012, 0, 1),
进入
ts = new Date.UTC(2012, 0, 1),
答案 0 :(得分:2)
此脚本中有一些错误:
1)...e.UTC(2012, 0, 1),
应以;
2)Date.UTC
不是构造函数。尝试:new Date(Date.UTC(2012, 0, 1));
进一步阅读:https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date/UTC