zeitrechen.php
Quell Code
<h5>Counter ende am 2019-11-09 00:00:00 von Php gesetzt</h5>
<h1 style="color:red">Restzeit = <span id="id1"></span></h1>
<?php
$endstamp = '2019-11-09 00:00:00';
?>
<script>
function countdown(time,id){
t = time;
y = Math.floor(t/(60*60*24*360)) % 24;
d = Math.floor(t/(60*60*24)) % 24;
h = Math.floor(t/(60*60)) % 24;
m = Math.floor(t/60) %60;
s = t %60;
if(y<1){
y=''
}else{
y=y+' Year ';
}
d = (d > 0) ? d+"d ":"";
h = (h < 10) ? "0"+h : h;
m = (m < 10) ? "0"+m : m;
s = (s < 10) ? "0"+s : s;
strZeit =y + d + h + ":" + m + ":" + s;
if(time > 0){
window.setTimeout('countdown('+ --time+',\''+id+'\')',1000);
}else{
strZeit = "Fertig";
}
document.getElementById(id).innerHTML = strZeit;
}
</script>
<script>countdown(<?php echo round((( strtotime($endstamp) - time())),0);?>,'id1');</script>
<hr><hr>