I tried to change the date format of this countdown jQuery script from local time to UTC, but it doesn’t work after my change. I even asked there but didn’t get an answer.
<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>
I have changed this :
ts = new Date(2012, 0, 1),
into
ts = new Date.UTC(2012, 0, 1),
You have some errors in this script:
1)
...e.UTC(2012, 0, 1),should end with;2)
Date.UTCis not a constructor. Try:new Date(Date.UTC(2012, 0, 1));further reading: https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date/UTC