更改 jQuery 倒数计时器中的日期
Change date in jQuery Countdown Timer
我的网站上有一个简单的倒数计时器。
我想在格林威治标准时间上午 9 点将日期从 1 月 25 日更改为 10 月 24 日?
演示:http://codepen.io/anon/pen/xEWJpY
我进行了大量的谷歌搜索,但对需要更改的内容感到非常困惑。
$(function () {
var austDay = new Date();
austDay = new Date(austDay.getFullYear() + 1, 1 - 1, 26);
$('#defaultCountdown').countdown({until: austDay});
$('#year').text(austDay.getFullYear());
});
#defaultCountdown { width: 240px; height: 45px; }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<h1>jQuery Countdown Basics</h1>
<p><strong>25th January</strong> == austDay = new Date(austDay.getFullYear() + 1, 1 - 1, 26);</p>
<div id="defaultCountdown"></div>
<hr>
<p> </p>
<p>What is October 24th at 9am?</p>
如有任何帮助,我们将不胜感激。
只需使用
new Date(year, month, day, hours, minutes, seconds, milliseconds)
将在 2016 年 10 月 24 日之前提供计数器。
var austDay = new Date();
austDay = new Date(austDay.getFullYear(), 10-1, 24, 9, 0);
仅供参考,
- 这只是一个示例,您可以根据需要进行必要的更改。
- 不要忘记在下面的示例中添加
countdown plugin
以获得输出。
希望这对您有所帮助。
$(function () {
var austDay = new Date();
austDay = new Date(austDay.getFullYear(), 10-1, 24, 9, 0);
$('#defaultCountdown').countdown({until: austDay});
$('#year').text(austDay.getFullYear());
});
#defaultCountdown { width: 240px; height: 45px; }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<h1>jQuery Countdown Basics</h1>
<!--p><strong>25th January</strong> == austDay = new Date(austDay.getFullYear() + 1, 1 - 1, 26);</p-->
<p>What is October 24th at 9am?</p>
<div id="defaultCountdown"></div>
<hr>
<p> </p>
我的网站上有一个简单的倒数计时器。
我想在格林威治标准时间上午 9 点将日期从 1 月 25 日更改为 10 月 24 日?
演示:http://codepen.io/anon/pen/xEWJpY
我进行了大量的谷歌搜索,但对需要更改的内容感到非常困惑。
$(function () {
var austDay = new Date();
austDay = new Date(austDay.getFullYear() + 1, 1 - 1, 26);
$('#defaultCountdown').countdown({until: austDay});
$('#year').text(austDay.getFullYear());
});
#defaultCountdown { width: 240px; height: 45px; }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<h1>jQuery Countdown Basics</h1>
<p><strong>25th January</strong> == austDay = new Date(austDay.getFullYear() + 1, 1 - 1, 26);</p>
<div id="defaultCountdown"></div>
<hr>
<p> </p>
<p>What is October 24th at 9am?</p>
如有任何帮助,我们将不胜感激。
只需使用
new Date(year, month, day, hours, minutes, seconds, milliseconds)
将在 2016 年 10 月 24 日之前提供计数器。
var austDay = new Date();
austDay = new Date(austDay.getFullYear(), 10-1, 24, 9, 0);
仅供参考,
- 这只是一个示例,您可以根据需要进行必要的更改。
- 不要忘记在下面的示例中添加
countdown plugin
以获得输出。
希望这对您有所帮助。
$(function () {
var austDay = new Date();
austDay = new Date(austDay.getFullYear(), 10-1, 24, 9, 0);
$('#defaultCountdown').countdown({until: austDay});
$('#year').text(austDay.getFullYear());
});
#defaultCountdown { width: 240px; height: 45px; }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<h1>jQuery Countdown Basics</h1>
<!--p><strong>25th January</strong> == austDay = new Date(austDay.getFullYear() + 1, 1 - 1, 26);</p-->
<p>What is October 24th at 9am?</p>
<div id="defaultCountdown"></div>
<hr>
<p> </p>