Re: Difference between two dates
| From: | Uma Shankari T. | Date: | Thu, 21 Feb 2002 06:23:19 +0000 |
| Subject: | Re: Difference between two dates | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-85683@lists.php.net to get a copy of this message | ||
Hello,
I got the solution for the date difference problem..,,
Thankyou very much.....
-Uma
"Uma Shankari T." <umashankari@lantana.tenet.res.in> wrote:
> If i gave the str date as "31-01-2001"; and $str1="04-02-2001"; then it
> is displaying the wrong result
>
> Plz tell me how can i rectify this problem...
Uma,
I wrote a function last year that calculates the time between 2 dates in
whatever unit is preferred (everything from seconds to years). My function
expects the date in a slightly different format, but it would be trivial to
switch the order of the date parts in one line and hard-code something for
the hours, minutes and seconds it expects in the date format. It wouldn't
matter what you hardcode them as since it would use the same time of day for
both dates.
http://www.befriend.com/code_gallery/php/get_elapsed_time/
--
Steve Werby
President, Befriend Internet Services LLC
http://www.befriend.com/