Re: Calculating difference between two days

From: Date: Wed, 14 Jun 2006 16:56:24 +0000
Subject: Re: Calculating difference between two days
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-237985@lists.php.net to get a copy of this message
afan@afan.net wrote:
I need to calculate no. of days between two dates, actually between date stored in DB and today's date. Does anybody has an example I can use?
Your database will have this function. In PostgreSQL: SELECT data_column - NOW() AS date_diff; There are similar functions for MySQL. Otherwise, consider converting your dates to unix time and subtracting the two numbers to find the date difference in seconds. These maay also be your friends: http://us3.php.net/manual/en/ref.datetime.php http://us3.php.net/manual/en/function.mktime.php http://us3.php.net/manual/en/function.date.php Dante

« previous php.general (#237985) next »