On 03/19/2013 09:02 AM, Gérard Lochon wrote:
----- Original Message ----- From: "Jeff Johnson" <[email protected]>
I would expect date() - {//} to be = date(). It probably doesn't
because it is an "empty" date and not a valid date.
Not at all.
As Lew said, the difference between two dates is not a date but a number.
"empty date" is a valid date, but this special value has special effects.
You tried datetime()-{//} ; would you expect datetime() - (datetime()-1)
to answer you a date instead of a number ?
When using dates, many people think we're using a mathematical "set of
dates", bijectivly joined to the natural set of numbers (N)
to which we apply relational operators and order.
But it is not the truth.
The relations between dates and N are not morphisms.
Dates are obtained using a complicated transformation function
(and that's why internally, the computer doesn't store dates
but numbers, working with numbers and encoding and decoding them
on the fly).
So, the appearance of a date is in reality a function f(d), and the
operations made with it (add, subtract) are compositions of this
primitive.
And there is no simple (mathematically) reverse one.
So you can't apply the usual mathematical rules as you would do
within the N set, you must comply with the function composition rules.
Adding to this, Foxpro supersede some mathematical rules,
so in the definition of the date() function, {//} is a "aggregator"
(i don't know if this word exist) like .null. is one for logical
operators.
G.
I am aware that the difference is a number because I use date & time
functions throughout my applications. The question comes up because:
datetime() - datetime() = 0
datetime() - {/:} = 0
datetime() = {/:} is false
Using numbers:
10 - 10 = 0
10 - 0 = 10
10 = 0 is false
10 - .NULL. = .NULL.
10 = .NULL. is .NULL. (not false)
The whole reason I asked the question is because these results are not
what I expected. I am not going to attempt to do math with empty
datetimes and just check for them being empty().
Thank you for your help!
Jeff
---------------
Jeff Johnson
[email protected]
(623) 582-0323
www.san-dc.com
www.arelationshipmanager.com
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.