1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
   |  
<span id="compte_rebours"></span>
<script type="text/javascript">
 function t(){
  var n=new Date();
  var ss= <?php echo datetime2timestamp($data['date_fin']);?>; //le timestamp de fin
  var s=ss-Math.round((n.getTime())/1000);
  var j=0,m=0,h=0;
  if(s<0){
   bxx.innerHTML='Achevé';
  }
  else{
   if(s>59){
    m=Math.floor(s/60);
    s=s-m*60;
   }
   if(m>59){
    h=Math.floor(m/60);
    m=m-h*60;
   }
   if(h>23){
    j=Math.floor(h/24);
    h=h-j*24;
   }
   if(s<10){
    s="0"+s;
   }
   if(m<10){
    m="0"+m;
   }
   if(h<10){
    h="0"+h;
   }
   if(j<10){
    j="0"+j;
   }
   bxx.innerHTML=j+"J "+h+"h "+m+"m "+s+"s";
  }
  window.setTimeout(t,999);
 }
 window.onload=function() {
  bxx=document.getElementById('compte_rebours'); 
  t();
};
d=new Date()
</script> | 
Partager