Re: Is there a function to subtract dates

From: Date: Fri, 12 Jan 2001 17:10:07 +0000
Subject: Re: Is there a function to subtract dates
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-34261@lists.php.net to get a copy of this message
Just subtract the Unix timestamps. ie. $past_date = mktime(12,45,0,5,6,1994); $diff = time() - $past_date; $days = $diff/86400; // number of seconds in a day echo (int)$days; // truncate to an integer -Rasmus On 12 Jan 2001, Matthew Brealey wrote: > I need to find the number of days between a date in the past and todays date. Does PHP have a > function to do this, or do I need to write my own? > > -- Random (non-anti-Microsoft) fortune > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#34261) next »