1

我尝试将此倒计时 jQuery 脚本的日期格式从本地时间更改为 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),
4

1 回答 1

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

于 2012-05-23T11:00:32.930 回答