function two(n) { return n<10 ? '0'+n : n } function quandoFecha(totPess, dataFechaStr) { if ( totPess > 0 ) { var now = new Date(); var mOffset = now.getTimezoneOffset() % 60; var hOffset = (now.getTimezoneOffset()-mOffset) / 60; var fecha = new Date(dataFechaStr+'-'+two(hOffset)+':'+two(mOffset)); fecha.setMinutes( fecha.getMinutes() - fecha.getTimezoneOffset() ); var el = document.getElementById('fecha'); el.title = fecha.toLocaleString(); var interval = setInterval(function(){ now = new Date(); left = new Date( fecha - now ); if ( left.valueOf() > 0 ) { el.innerHTML = 'Fecha em '+two(left.getUTCHours())+':'+two(left.getUTCMinutes())+':'+two(left.getUTCSeconds())+'.'; } else { el.innerHTML = 'Fecha '+fecha.toLocaleString()+'.'; clearInterval(interval); } },200); } }

This topic: Main > WebHome > WebPreferences > QuandoFechaJS
Topic revision: 20 Jul 2014, AurelioAHeckert
 
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Raulwiki? Send feedback