Support Topics Documentation Slack YouTube Blog

Usage equals in comparison of dates


(Carlos Alberto) #1

For some reason, can someone explain to me why the equal does not work in comparing dates with <=, but works with >=
???

example:

(date at or after '02/08/2019 ') or >=

he finds date with '02/08/2019 ’
but,

(date at or before ‘02/08/2019’) ou <=

can not find, and

(date = ‘02/08/2019’)

thanks.


(Mark Piller) #2

Dates are stored as timestamps. When you use the equals sign, it must match the value precisely (to the second)


(Carlos Alberto) #3

I understood, this is my problem. I only need the dates, and the timestamps end up causing me imprecision


(Mark Piller) #4

Try using a whereClause in the format:

yourDateColumn > mm/dd/yyyy 00:00 and yourDateColumn < mm/dd/yyyy 23:59

I haven’t tried it to verify it works, but I suspect it should be something like that.

Regards,
Mark


(Carlos Alberto) #5

Thank you, it worked.

For anyone who has problem, to use the <= ( at or before) have in the database the date with 00:00 and in the whereCause 23:59.

Example:
date <= ‘MM/dd/yyyy 23:59’

database MM/dd/yyyy 00:00