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
  • Is your dbValue a local variable or a rule input of date and time type? If its a rule input of the same data type as now() there shouldn't be an issue if not then it is comparing a text with a timestamp which will not give desired output. Try converting it using todatetime before comparison and it should work.

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

Reply
  • Is your dbValue a local variable or a rule input of date and time type? If its a rule input of the same data type as now() there shouldn't be an issue if not then it is comparing a text with a timestamp which will not give desired output. Try converting it using todatetime before comparison and it should work.

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

Children