English 中文(简体)
将倒计时脚本日期更改为通用时间
原标题:Change the date of countdown script to universal time

我试图改变这个 < a href=> 的日期格式, 从本地时间到 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),
最佳回答

您在此脚本中有一些错误 :

1) .e.UTC(2012, 0, 1), 应该以 结尾;

2) Date.UTC 不是一个构建器。 请尝试 : new date( 日期: UTC( 2012, 0, 1) );

更多信息:https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date/UTC

问题回答

暂无回答




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签