<?php
$toDate = $_product->getSpecialTODate();
$count = 1;
if($toDate && strtotime($toDate)>time()){
$date = new DateTime($toDate);
?>
<input type="hidden" id="todate" value="<?php echo $date->format('m/d/Y')?>" />
<div class="time_d">
<span class="countdown_section dealcountday">
<span class="countdown_amount" id="dealcountday"></span>
</span>
<span class="countdown_section">
<span class="countdown_amount" id="dealcounthour"></span>
<span class="countdown_amount min" id="dealcountmin"></span>
<span class="countdown_amount sec" id="dealcountsec"></span>
<span class="countdown_amount milisec" id="dealcountmilisec"></span>
</span>
</div>
<script language="JavaScript">
var todate = document.getElementById("todate").value;
date = new Date(todate);
var target_date = date.getTime();
var weeks,days, hours, minutes, seconds;
var countdown = document.getElementById("dealcounthour");
setInterval(function () {
var current_date = new Date().getTime();
var totalseconds_left = (target_date - current_date) ;
var seconds_left = (target_date - current_date) / 1000;
days = parseInt(seconds_left / 86400);
if (days>0) {
seconds_left = seconds_left % 86400;
}
if (days<=0) {
dealcountday.style.display = "none";
}
hours = parseInt(seconds_left / 3600);
seconds_left = seconds_left % 3600;
minutes = parseInt(seconds_left / 60);
seconds = parseInt(seconds_left % 60);
miliseconds= (totalseconds_left % 1000); //alert(seconds);
dealcountday.innerHTML = "<strong>"+days+"</strong>" + ' Day(s)';
dealcounthour.innerHTML = "<strong>"+hours+": </strong>" ;
dealcountmin.innerHTML = "<strong>"+ minutes+": </strong>";
dealcountsec.innerHTML = "<strong>"+seconds +': </strong>';
dealcountmilisec.innerHTML="<strong>"+miliseconds+"</strong>";
}, 10);
</script>
<?php } ?>
$toDate = $_product->getSpecialTODate();
$count = 1;
if($toDate && strtotime($toDate)>time()){
$date = new DateTime($toDate);
?>
<input type="hidden" id="todate" value="<?php echo $date->format('m/d/Y')?>" />
<div class="time_d">
<span class="countdown_section dealcountday">
<span class="countdown_amount" id="dealcountday"></span>
</span>
<span class="countdown_section">
<span class="countdown_amount" id="dealcounthour"></span>
<span class="countdown_amount min" id="dealcountmin"></span>
<span class="countdown_amount sec" id="dealcountsec"></span>
<span class="countdown_amount milisec" id="dealcountmilisec"></span>
</span>
</div>
<script language="JavaScript">
var todate = document.getElementById("todate").value;
date = new Date(todate);
var target_date = date.getTime();
var weeks,days, hours, minutes, seconds;
var countdown = document.getElementById("dealcounthour");
setInterval(function () {
var current_date = new Date().getTime();
var totalseconds_left = (target_date - current_date) ;
var seconds_left = (target_date - current_date) / 1000;
days = parseInt(seconds_left / 86400);
if (days>0) {
seconds_left = seconds_left % 86400;
}
if (days<=0) {
dealcountday.style.display = "none";
}
hours = parseInt(seconds_left / 3600);
seconds_left = seconds_left % 3600;
minutes = parseInt(seconds_left / 60);
seconds = parseInt(seconds_left % 60);
miliseconds= (totalseconds_left % 1000); //alert(seconds);
dealcountday.innerHTML = "<strong>"+days+"</strong>" + ' Day(s)';
dealcounthour.innerHTML = "<strong>"+hours+": </strong>" ;
dealcountmin.innerHTML = "<strong>"+ minutes+": </strong>";
dealcountsec.innerHTML = "<strong>"+seconds +': </strong>';
dealcountmilisec.innerHTML="<strong>"+miliseconds+"</strong>";
}, 10);
</script>
<?php } ?>
No comments:
Post a Comment