|
Posted by Simon Dean on 12/15/05 10:08
Gordon Burditt wrote:
>> Probably being a little thick here, but when you subtract one date
>> away
>
>> from another, how do you convert the resultant value into a number
>> of
>
>> days... I guess I could easily / 60 / 60 / 24... but that seems
>> barbaric... Anything neater?
>
>
> First off, you need to nail down what answer you want a little more.
> You will not always get agreement on these:
>
> 1. How many days are there between January 1 and January 2? My
> answer: NONE, those two days are next to each other, and therefore
> none of them are Mondays regardless of what year it is.
Inclusive of the start day and end day.
> 2. How many days are there between January 2 and January 2 (of the
> same year)? My answer: this doesn't really make sense, but if you
> insist, negative one.
1.
> If, on the other hand, you're trying to figure out how many work days
> there are between the morning of date X and the evening of date Y,
> some people might consider the answers to the above questions as 2
> and 1, respectively.
I figure somehow, will need to somewhat ignore the time, maybe get the
two dates, set the time to the same value, then work out the day
difference and add one to get the result I want...
Still though, don't know how to convert the result of $date1 - $date2 to
something more useful, like, minutes, hours, or days.... That's the only
stumbling block as far as Im concerned, Im sure I can work out the other
bits.
Cheers
Simon
[Back to original message]
|