0

我有如下代码,我想为它设置时区。我可以知道我该怎么做吗?

代码:

<script type="text/javascript">
  $(function () {
    var year = new Date();

    year = new Date(year.getFullYear(), 11 - 1, 20);

    $('#dvCountDown').countdown({
      until: new Date('2013-02-08'),
      format: 'HMS',
      onExpiry: liftOff
    });

    $('#CountdownbyValue').countdown({
      until: '0h +0m +8s',
      format: 'HMS',onExpiry: liftOff
    });

    $('#year').text(austDay.getFullYear());

    //Time is up!
    function liftOff() { 
      alert('Time is up!'); 
    }

  });
</script>
4

1 回答 1

0

尝试使用这个:

var year = new Date();
year.setUTCMonth(11 - 1);
year.setUTCDay(20);
year.setUTCHour( /* your timezone offset */ );
year.setUTCMinutes( /* your timezone offset */ );
year.setUTCSeconds(0);

$('#dvCountDown').countdown({
  until: new Date(Date.UTC(2013, 2-1, 08)),
  format: 'HMS',
  onExpiry: liftOff
});
于 2013-02-07T17:22:56.230 回答