Reputation: 151
I use this countdown on my website, here
You can view the script here (Too large to post)
This is the code in the head section:
<script type="text/javascript" src="javascripts/jquery.countdown.js"></script>
<script type="text/javascript">
$(function () {
var austDay = new Date();
austDay = new Date(austDay.getFullYear() + 1, 1 - 1, 26);
$('.countdown-container').countdown({until: austDay});
$('#year').text(austDay.getFullYear());
});
</script>
I want to be able to change the countdown duration, hopefully to what ever time I want.
If anyone could lend an insight then that would be fantastic.
Upvotes: 0
Views: 5028
Reputation: 49
I had the same questions but Hussein's explanation help me solve it.
For example if you want to countdown to 25.10.2017 the code should be
Date(CommingDate.getFullYear() + 1, 10 - 1, 25);
where
CommingDate.getFullYear() + 1 - it's 2017 (actual year + 1)
10 - 1 - it's the month
25 - it's the day
Upvotes: 1
Reputation: 2557
Edit:
var CommingDate = new Date();
CommingDate= new Date(CommingDate.getFullYear() + 1, 1 - 1, 26);
explanation
Date(
CommingDate.getFullYear() + 1, 1 - 1, 26);
means that you want to get the current year an increase it by 1
Date(CommingDate.getFullYear() + 1,
1 - 1, 26);
the first number will go forwards a month , so if you were to do 2 - 1
the month will be Feb
but if you were to do something like 1 - 1
this will result in getting the current month
Date(CommingDate.getFullYear() + 1, 1 - 1,
26);
the last number 26 will be the day that you want
Upvotes: 1