You can convert the time into seconds using mktime(), subtract one from
the other, and then reformat it using gmstrftime:
//int mktime ( int hour, int minute, int second, int month, int day, int
year [, int is_dst])
//string gmstrftime ( string format [, int timestamp])
<?
$time1 = mktime (0,0,0,12,32,1997);
$time2 = mktime (0,0,0,12,31,1995);
$dif = $time1 - $time2;
$new_time = gmstrftime("%b %d %Y", $dif);
echo "$time1<br>";
echo "$time2<br>";
echo "$dif<br>";
echo "$new_time<br>";
?>
The output looks like this:
883641600
820396800
63244800
Jan 03 1972
Of course you will have to get the date out of the current format you
have it, but that shouldn't be too hard using explode() and implode();
Steven J. Walker
Walker Effects
www.walkereffects.com
[EMAIL PROTECTED]
On Tuesday, February 19, 2002, at 06:51 PM, Uma Shankari T. wrote:
>
>
>
> Hello,
>
> How can i find out the difference between two dates.
>
> I am having the date like this
>
> $str="10-01-2001";
> $str1="01-02-2002";
>
> I need to find out the difference between the date,month and year.
>
> If anyone know the solution for this problem plz tell me
>
>
> -Uma
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>