SkyD Posted March 9, 2006 Report Share Posted March 9, 2006 :D~~ Nu smieklīgi, bet man nesanāk. Kā, lai apreiķina usera vecumu, ja formats ir piem. 1.3.1993 vai 13.12.1956 [dat.men.gads] .?? Man tur izmet visādus hujovus. Link to comment Share on other sites More sharing options...
Vebers Posted March 9, 2006 Report Share Posted March 9, 2006 (edited) function vecums($gadss){ $cipari = explode('-', $gadss); $gads=$cipari[0]; $menesis=$cipari[1]; $diena=$cipari[2]; $vecums = date('Y')-$gads; if ((date('n')<$menesis) || (date('n')==$menesis && date('j')<$diena)) { return $vecums-- -1; } else { return $vecums--; } } EDIT: funkcija njemta no šī paša foruma ja nemaldos.. Edited March 9, 2006 by MakaTaNaw Link to comment Share on other sites More sharing options...
Grey_Wolf Posted March 9, 2006 Report Share Posted March 9, 2006 no kurienes tev naak dati? kaadaa formaataa? tavaa gadiijumaa paarveert to visu unixtimestamp formaataa un tiiri matemaatiski (atnjeomt) izreekjini ja no DB tad var mazliet savaadaak Link to comment Share on other sites More sharing options...
SkyD Posted March 10, 2006 Author Report Share Posted March 10, 2006 Nu ja. No DB man naak.. Un ir man formāts [diena.meenesis.gads]. Un var buut 3.4.2005 - treshais aprillis 2005 gads, var buut 14.11.2005 - 14 novembris 2005 gads. Un tur rodas problēma atņemot. Viņš man tur nepareizi atņēma. Lai ir tā, ka skatās arī tos datumus, jo man bija, ka skatiijaas tikai gadu, un kamer veel nav dzimene, uzraada jau tos gaduss.. Link to comment Share on other sites More sharing options...
SkyD Posted March 10, 2006 Author Report Share Posted March 10, 2006 Viss ok. Atradu =] Link to comment Share on other sites More sharing options...
Grey_Wolf Posted March 10, 2006 Report Share Posted March 10, 2006 Ja tu datus DB glaabaatu tam paredzeetajaa formaataa DATATIME tad probleemu buutu krietni mazaak :) vareetu no DB dabuut visus nepiecieshamos datus : pilnu vecumu, videejo vecumu, vecumo No Liidz utt.. ----------- pilna vecuma noteikshana (pilnos gados) --------- SELECT (YEAR(CURDATE()))-(YEAR(VECUMS))-IF(RIGHT(CURDATE(),5)<RIGHT(vecums,5),1,0) AS pilni_gadi FROM tabula.... Link to comment Share on other sites More sharing options...
Recommended Posts