We also have to define relation operators behavior: ==, =, <, >, <=, >=
when DATE and TIMESTAMP are used.
We have the following choices:
1. compare only date part ignoring the time with the exception for ==
   operator which will make exact comparison. For this exact comparision
   we also have two choices:
   a. strict type checking => results always .F.
   b. if dates are equal and time part in TIMESTAMP item is 0 then
      result is .T. otherwise .F.
2. convert DATE to TIMESTAMP setting 00:00 as TIME and compare items
   like two TIMESTAMP values.
   In such way works xHarbour.
3. use asymmetric comparison like for strings so:
      FIELD->DATETIME <= date()
   will work but
      date() => FIELD->DATETIME
   won't.

Hi,


I vote 1b.

2 is also acceptable for me.

3 Well a can not even understand the third choice. The truth is, that still do not understand string comparison in Clipper, but very well understand strcmp() behaviour. I always use ==, and I change != to !( == ), for strings. I had a luck, that using of <, > does not cause bugs in my code, and I try to avoid using <=, >= for strings.


More on 1b vs 2. 1b gives more expected results for:
  dDate := DATE()
  DATETIME <= dDate

1b result is TRUE for yesterday and older timestamps, but it is also true, for all timestamps of today, just as I expect writing "DATETIME<=dDate".

2 results is TRUE for yesterday and older timestamps, and only a midnight of today. If DATETIME is midnight + 1 milliseconds is not less or equal to dDate. I guess writing "DATETIME<=dDate", you've did not expected to include values of exactly midnight, and not include midnight + 1 millisecond.


Best regards,
Mindaugas

_______________________________________________
Harbour mailing list
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to