Anyone got a date math routine?
Jay R. Ashworth
jra at baylink.com
Tue Dec 4 13:43:38 PST 2007
On Tue, Dec 04, 2007 at 04:32:51PM -0500, Kenneth Brody wrote:
> Using TIME, 12:00:00 minus 13:00:00 equals 23:00:00. (That is, noon
> minus 13 hours is 11PM.)
>
> Using HMS, 12:00:00 minus 13:00:00 equals -1:00:00. (That is, negative
> one hour.)
So, if I add or subtract a string which looks like a time from a TIME
field, filePro will assume it's a duration and give me another
timestamp, and if I subtract it from an HMS field, it will assume it's
another timestamp and give me the duration between those times.
Got it.
It doesn't, actually, matter what the type of the second field is?
And presumably you can't add to an HMS field?
Or is the controlling issue the type of the *second* field? Or must
both fields be the same type?
> Using HMS, there is no need to split the time at midnight.
> Take today at 6PM minus yesterday noon:
>
> Today minus yesterday = 1 day = 24 hours.
> 18:00:00 minus 12:00:00 = 6:00:00 = 6 hours.
>
> 24 hours plus 6 hours = 30 hours = the correct answer.
>
> Now, today 6AM minus yesterday noon:
>
> Today minus yesterday = 1 day = 24 hours.
> 6:00:00 minus 12:00:00 = -6:00:00 = negative 6 hours.
>
> 24 hours plus negative 6 hours = 18 hours = the correct answer.
It's an identity with what I said, expressed more concisely. Assuming
your fields are HMS. :-)
Cheers,
-- jra
--
Jay R. Ashworth Baylink jra at baylink.com
Designer The Things I Think RFC 2100
Ashworth & Associates http://baylink.pitas.com '87 e24
St Petersburg FL USA http://photo.imageinc.us +1 727 647 1274
Witty slogan redacted until AMPTP stop screwing WGA
More information about the Filepro-list
mailing list