Re: Calculating difference between two days

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



afan@xxxxxxxx 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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux