BlackWolf Posted December 7, 2008 Report Share Posted December 7, 2008 Ka izveidot laika atskaiti sakot no 30 minutem ? Piemeram man ir forma, pec kuras submita es nevelos lai lietotajs to varetu aizpildit velreiz nakamo 30 minusu laika ! Meginaju ar timestamp paspeleties - nesanaca .. Vajag lai lietotajs redz ka piemeram : "Lidz atkartotai pieejai : 14 min. 28 sek." un pie lapas refresh sis laiks turpina no vietas kur vins bija, nevis no saakuma .. Kaa lai to panaak ? Link to comment Share on other sites More sharing options...
Grey_Wolf Posted December 7, 2008 Report Share Posted December 7, 2008 (edited) Vajag lai lietotajs redz ka piemeram : "Lidz atkartotai pieejai : 14 min. 28 sek." un pie lapas refresh sis laiks turpina no vietas kur vins bija, nevis no saakuma ..7peec formas submita ieraksti sessijaa laiku un talak to pashu laiku (sekundes ) JS , pie lapas refresa parbaudi cik laikaa pagajis un atkartoti padod JS pslikusaas sekundes ... Tas ir: if(!issest($_SESSION['laiks'])) { $laiks_patreiz=1800; $_SESION['laiks']=time(); } else { $laiks_pagajis=$time()-$_SESSION['laiks']; $laiks_patreiz=1800-$laiks_pagajis; // tik laiks vel palicis , var buut arii negatiivs skaitlis tapeec japarbauda if($laiks_patreiz<0) { $laiks_patreiz=0; } } echo '<script>'; echo " var laiks_radit= $laiks_patreiz;"; echo '</script>'; aptuveni sadi --> pasaa JS parbaudam vai laiks_radiit nav == 0 ja nav tad skaitam to laiku ... --> kaa JS izveidot laika atskaiti , pameklee Netaa .. pilns ar piemeriem ... edit: oj.. Velviens Vilks paraadijies ... Edited December 7, 2008 by Grey_Wolf Link to comment Share on other sites More sharing options...
BlackWolf Posted December 7, 2008 Author Report Share Posted December 7, 2008 Ja, par to parbaudi ok - isti problemu itkaa nav .. Bet problema ir ta ka es nezinu kaa izvadit to "14 min. 27 sek." ! Ka no sekundem dabut minutes atmetot atlikumu & parversot to sekundes ? ( skan baisi ) Piemeram - pagaja 1602 sek. ! Ka no si skaitla izdabut formatu minutes:sekundes ? Link to comment Share on other sites More sharing options...
Val Posted December 7, 2008 Report Share Posted December 7, 2008 MM:SS - sekundes izdali ar 60, paņem veselo daļu no skaitļa un iegūsi minūtes (MM) - sekundes mīnus veselās minūtes reiz 60, iegūsi sekundes (SS) Link to comment Share on other sites More sharing options...
BlackWolf Posted December 7, 2008 Author Report Share Posted December 7, 2008 Un kaa "panemt" to veselo dalu, nepazaudejot parejo ? Link to comment Share on other sites More sharing options...
codez Posted December 7, 2008 Report Share Posted December 7, 2008 time=1602; min=Math.floor(sec/60); sec=time-(min*60); Link to comment Share on other sites More sharing options...
Grey_Wolf Posted December 7, 2008 Report Share Posted December 7, 2008 Piemeram - pagaja 1602 sek. ! Ka no si skaitla izdabut formatu minutes:sekundes ? sakumskolas matimatikas uzdevums !!!Tiesam nespeji pats izdomaat ??? Piedevaam JS parsvaraa izmanto MiliSekundes , taa kaa ar shadaam matimatikas zinasanam Tev nespiid kautko uztaisiit :( Naksies vien maciities ... Link to comment Share on other sites More sharing options...
Recommended Posts