Facing issue with date comparison

Hi,

I am trying to compare two dates one is stored in DB (lets call it dbValue) and another one is from now ( ).

Now, where I have :

dbValue: 10/02/2021 09:00 AM

now: 10/1/2021 9:18 AM EDT

dbValue<now

it gives me true

dbValue: 09/30/2021 09:00 AM

now: 10/1/2021 9:18 AM EDT

dbValue<now

it again gives me true

Not sure what's the issue, please help me.

  Discussion posts and replies are publicly visible

Parents Reply Children
  • Also to note, the todatetime() function applies a timezone offset, "todatetime("10/02/2021 09:00 AM")" in eastern time will return 5 AM ET.  To return the actual text value of the time, apply gmt() as:

    gmt(todatetime("10/02/2021 09:00 AM"))

    It is also strongly encouraged to use proper data types when storing to the DB, storing such things as datetime values as text will most certainly present issues down the road.