Re: Calculate No Of Days

From: Date: Tue, 04 Jan 2005 03:58:49 +0000
Subject: Re: Calculate No Of Days
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-205567@lists.php.net to get a copy of this message
Khuram Noman wrote:
Hi Is there any function avialable in PHP to calculate the no of days by passing 2 dates like 1 argument is 1/1/2005 and the second one is 1/2/2005 then it returns the no of days or how can i do that if there is no builtin function . Regards Khuram Noman __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Here's a piece of code that I use on my website. It calculates the number of days from today to some future date (which happens to be July 16, 2005) It's not exactly what you asked for but it might be helpful to you. No one will confuse me with being a professional programmer but this seems to work well on my site. <snippet ---- $timeuntilcamp = mktime(12,0,0,7,16,2005,-1) - time(); $daysuntilcamp = round($timeuntilcamp/86400); if ($daysuntilcamp > 0) { print "<h4>Days until start of 2005 Camp: ".$daysuntilcamp."</h4>\n"; } ---- snippet> You can see it in "action" by visiting: http://www.salkehatchiehuntersville.com/Salkehatchie_2005_Camp.php -- Jerry Kita http://www.salkehatchiehuntersville.com email: jskita@attglobal.net

« previous php.general (#205567) next »