rudzis Posted August 4, 2005 Report Share Posted August 4, 2005 Savajadzējās vecuma noteikšanas kodu, ja padots ir gads, mēnesis un diena. Varbūt kādam ir saglabājies? Link to comment Share on other sites More sharing options...
bubu Posted August 4, 2005 Report Share Posted August 4, 2005 heh. A loģiski padomāt nevarēji kā nosaka vecumu? Datumus atņem, ne? $gads = 2004; $menesis = 3; $diena = 4; $vecums = date('Y')-$gads; if ((date('n')<$menesis) || (date('n')==$menesis && date('j')<$diena)) { $vecums--; } echo "Tavs vecums ir $vecums gadi."; Link to comment Share on other sites More sharing options...
rudzis Posted August 4, 2005 Author Report Share Posted August 4, 2005 Tu esi Tētis ;) Link to comment Share on other sites More sharing options...
Analgiins Posted August 5, 2005 Report Share Posted August 5, 2005 interesanti, a kas buut php.lv forums bez bubu ? :) Link to comment Share on other sites More sharing options...
Delfins Posted August 5, 2005 Report Share Posted August 5, 2005 interesanti, a kas buut php.lv forums bez bubu ? :) 20344[/snapback] tas tač loģiski - būtu cits spameris.. :) PS: bubu, tev nav ko darīt? jeb RSS-ā lasi php.lv forumu ? Link to comment Share on other sites More sharing options...
bubu Posted August 5, 2005 Report Share Posted August 5, 2005 (edited) Tu esi Tētis ;)20297[/snapback] Kur nu.. es vēl jauns un neprecējies.interesanti, a kas buut php.lv forums bez bubu ? smile.gifTas būtu forums bez bubu.PS: bubu, tev nav ko darīt? jeb RSS-ā lasi php.lv forumu ?Abi divi Delfins, abi divi. Izklaidējos tā teikt. Un vispār jāiet gulēt! Edited August 5, 2005 by bubu Link to comment Share on other sites More sharing options...
PheliX Posted August 6, 2005 Report Share Posted August 6, 2005 kur ta nu guleet - veel taksh agrs :D Link to comment Share on other sites More sharing options...
Grey_Wolf Posted August 6, 2005 Report Share Posted August 6, 2005 (edited) ja tas viss naak no MYSQL lauka DATATIME (lauka nosaukums vecums atdgriez vecums2) tad vari izmantot: "select (YEAR(CURDATE()))-(YEAR(VECUMS))-IF(RIGHT(CURDATE(),5)<RIGHT(vecums,5),1,0) as vecums2 from ttt" atgriez pilnu vecumu gados :) ---------- Lai straadaa MYSQL :) labots: aizmirsu piebilst tieshi sadu fiichu delj izmantoju MYSQL DATATIME lauku nevis UNIXtime... - viegla datumu konvertaacija abos virzienos PHP <--> MYSQL itkaa UNIXTIME buutu vieglaak, bet tuur var paraadiities gljuki zem 1970 gada MYSQL tas ir noveersts, webaa jau vienmeer buus cilveeki kas vecaaki par 35 gadiem :) Edited August 6, 2005 by Grey_Wolf Link to comment Share on other sites More sharing options...
Recommended Posts