2
votes

using this jquery countdown script http://keith-wood.name/countdown.html like this:

 <script type="text/javascript">
$(function () {
    var today = new Date();
    var tomorrow = new Date();
    tomorrow.setDate(today.getDate() + 1);
    var tm = new Date(tomorrow.getFullYear(),tomorrow.getMonth(), tomorrow.getDate());
    $('#defaultCountdown').countdown({until: tm});
});
</script>

and this

<div id="defaultCountdown"></div>

allows me to show a countdown based on pc time for 24 hours. now i want also to get the date in this but i don't want the current date i want the next day date

1
so you want a 48 hour countdown? - glend
no i want to show the date like Tuesday 21 April but i need to be the next day always. If today is Tuesday i need to show Wednesday and so on. - Matthews Larissa

1 Answers

0
votes

I am not sure that your plugin allow this kind of feature, so you have to make your own like that :

<style>
#tomorrow{
    width: 240px; 
    height: 45px;
    margin-bottom:10px;
}
#tomorrow .countdown-section{
    padding-left:5px;
}
</style>
<div id="tomorrow" class="is-countdown">
    <span class='countdown-section'><span class='countdown-amount' id='tomorrowDay'></span><span class='countdown-period'>Day</span></span>
    <span class='countdown-section'><span class='countdown-amount' id='tomorrowDate'></span><span class='countdown-period'>Date</span></span>
    <span class='countdown-section'><span class='countdown-amount' id='tomorrowMonth'></span><span class='countdown-period'>Month</span></span>
</div>
<script>
function setTomorrow(){
    var today = new Date();
    var tomorrow = new Date();
    tomorrow.setDate(tomorrow.getDate() + 1);   
    tomorrow.setHours(0);   
    tomorrow.setMinutes(0); 
    tomorrow.setSeconds(0); 
    tomorrow.setMilliseconds(0);    
    var timer = (tomorrow - today);
    $("#tomorrowDay").text(['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'][tomorrow.getDay()]);
    $("#tomorrowDate").text(tomorrow.getDate());
    $("#tomorrowMonth").text(['January','February','','March','April','May','June','July','August','September','October','November','December'][tomorrow.getMonth()]);  
    setTimeout(function(){ setTomorrow(); }, timer);    
}
setTomorrow();
</script>