Re: difference between two dates

From: Date: Mon, 20 Jan 2003 04:47:46 +0000
Subject: Re: difference between two dates
References: 1 2  Groups: php.db 
Request: Send a blank email to php-db+get-24961@lists.php.net to get a copy of this message
On Sun, Jan 19, 2003 at 09:34:02AM -0500, John W. Holmes wrote: >> I tried this : >> >> $dobtimestamp = mktime(0,0,0,$cboMM,$cboDD,$cboYY); >> $todaytimestamp = time(); >> $txtAge = ($todaytimestamp - $dobtimestamp)/86400; >> >> It does not give me the expected output. >> >> Can anybody suggest something ? > >Keep your mktime() as it is, that's correct. Then use something like >this to calculate the age: > >$age = date('Y',$now) - date('Y',$dob) - >((date('z',$now)>=date('z',$dob)) ? 0 : 1); > >where $dob and $now are the appropriate unix timestamps that you've >already got calculated with mktime() and time(). Thanks a lot. Peace -- Rajesh : ####[ GNU/Linux One Stanza Tip (LOST) ]####################### Sub : ext3 file system LOST #034 To implement ext3 filesystem have a good look here (Cool) : http://www.uow.edu.au/~andrewm/linux/ext3/ext3-usage.html ####<rfowkar@yahoo.com>####################################### :

« previous php.db (#24961) next »