Wuu Posted November 19, 2008 Report Posted November 19, 2008 Man ir šāds tekstiņš 2008-11-19 22:22:24 kā lai nogriež laiku? Lai paliktu tikai 2008-11-19
xPtv45z Posted November 19, 2008 Report Posted November 19, 2008 list($date, $time) = explode(' ','2008-11-19 22:22:24 ');
marcis Posted November 20, 2008 Report Posted November 20, 2008 <?=date("Y-m-d",strtotime("2008-11-19 22:22:24"));?>
Wuu Posted January 4, 2009 Author Report 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 :)
marcis Posted January 4, 2009 Report 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
Grey_Wolf Posted January 4, 2009 Report 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
Recommended Posts