Date comparisons

Using the Classic Framework. I want to test to see if d1 >= d2, where d1 and d2 are Date objects. I want to test them only as Dates, not DateTimes. I know I can set the Hour, Minute and Second for each one to 0 and then test that way. But now I’m comparing these instead:

d1.SQLDate d2.SQLDate

That appears to allow a successful comparison of Dates without comparing DateTimes, doing things like this:

If d1.SQLDate >= d2.SQLDate Then . . .

Is there a problem doing it this way?

this is THE way of doing it !

Cool. I’ve always compared Date.TotalSeconds.

totalseconds works too.

For the case of date AND time yes, but the OP was asking about comparing the date part ONLY without setting the hour, minute, and second values to zero. And the easiest way (I know of) is to compare SQLDate properties.

no… then you would use SQLDATETIME instead of SQLDATE

SQLDATE returns 2019-01-02
while
SQLDATETIME returns 2019-01-02 13:20:43

both SQLDATETIME and TOTALSECONDS would reflect the same TimeZone value

My response was to the “totalseconds works too” – which does work as does SQLDATETIME – but neither works for the OP purpose.

I understand that… never said it DIDN’t work… but your reply inferred that was the only way, which as we both know it isn’t

And I never said it was the ONLY way – merely said totalseconds works for the case of date and time. Not sure why you think I inferred it was the only way. But the OP post has been resolved, so there is little point to a continued semantic argument now.

Nobody has answered the original question.
Y’all won’t like my answer, so I was hoping someone else would.

Actually, the first reply did answer the question, and was marked as the answer by the OP. We should have left well enough alone…

[quote=419995:@Tim Parnell]Nobody has answered the original question.
Y’all won’t like my answer, so I was hoping someone else would.[/quote]

actually it was answered, by pointing out the OP method was a good method, then other added more information as well as alternatives