You could just parse the dates out and feed them to mktime(), subtract
the difference between the two (in seconds) and use that to determin the
number of days...
Something like:
<?php
$date1="06/01/2006";
$date2 = date('m/d/Y');
echo " $date1 -- $date2\n";
list($m,$d,$y) = explode("/",$date1);
$one = mktime(0,0,0,$m,$d,$y);
list($m,$d,$y)=explode("/",$date2);
$two = mktime(0,0,0,$m,$d,$y);
$diff = $two - $one;
$days = $diff / (60*60*24);
echo "$days\n";
?>
afan@xxxxxxxx wrote:
Hi,
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?
I found an example on
http://www.developertutorials.com/tutorials/php/calculating-difference-between-dates-php-051018/page1.html
but function gregoriantojd() doesn't work for me
Fatal error: Call to undefined function: gregoriantojd()
Found this:
Please read the manual:
http://www.php.net/manual/en/ref.calendar.php
You need to either compile the extension in or load it.
Since you provided no details about your situation at all,
I cannot help you further.
on
http://bugs.php.net/bug.php?id=10151&edit=1
Thanks on any help.
-afan
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php