Wuu Posted November 19, 2008 Report Share Posted November 19, 2008 Man ir šāds tekstiņš 2008-11-19 22:22:24 kā lai nogriež laiku? Lai paliktu tikai 2008-11-19 Link to comment Share on other sites More sharing options...
Val Posted November 19, 2008 Report Share Posted November 19, 2008 nu kautvai http://lv2.php.net/substr Link to comment Share on other sites More sharing options...
xPtv45z Posted November 19, 2008 Report Share Posted November 19, 2008 list($date, $time) = explode(' ','2008-11-19 22:22:24 '); Link to comment Share on other sites More sharing options...
marcis Posted November 20, 2008 Report Share Posted November 20, 2008 <?=date("Y-m-d",strtotime("2008-11-19 22:22:24"));?> Link to comment Share on other sites More sharing options...
Wuu Posted January 4, 2009 Author Report Share Posted January 4, 2009 Ar ko man atgriezt datus pirms punkta? 23.45464747 Lai atgrieztu 23 ? Nevaru izprast tās php stringu darbība kaut nošauties puse funkciju jegu vispār nesaprotu :) Link to comment Share on other sites More sharing options...
marcis Posted January 4, 2009 Report Share Posted January 4, 2009 (edited) Ja tas intedžers, tad vari apaļot. Ja strings, tad vari meklēt punkta pozīciju un nogriezt lieko, vai spridzināt pa punktu. # int $var=23.45464747; echo round($var); # string $var="23.45464747"; echo substr($var,0,strpos($var,".")); // vai $str=explode(".",$var); echo $str[0]; Edited January 4, 2009 by marcis Link to comment Share on other sites More sharing options...
Grey_Wolf Posted January 4, 2009 Report Share Posted January 4, 2009 Man ir šāds tekstiņš 2008-11-19 22:22:24 kā lai nogriež laiku? Lai paliktu tikai 2008-11-19 Stipri vien iskataas ka tas naak no DB, ja taa ir tad Uzreiz no DB ielasi pareizaa formataa Vari izmantot SQL f-ju DATE_FORMAT(date,format) SELECT id, datix,...... dati_n , DATE_FORMAT(datums,'%d-%m-%Y') FROM tabulis Sit plasaak Link to comment Share on other sites More sharing options...
Wuu Posted January 4, 2009 Author Report Share Posted January 4, 2009 Paldies! Link to comment Share on other sites More sharing options...
Recommended Posts