Re: Difference between two dates
| From: | Steve Werby | Date: | Wed, 20 Feb 2002 14:54:49 +0000 |
| Subject: | Re: Difference between two dates | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-85533@lists.php.net to get a copy of this message | ||
"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/