How to compare 2 dates?

Hi,

I parse 2 dates: EXPIRE and DATE in yyyy.mm.dd format.
I want to compare them using something like this:
IF @EXPIRE GreaterThan @DATE
data. STATUS = “SUCCESS”;
ELSE
data. STATUS = “EXPIRED”;
END
but it doesn’t work.
An idea?

Thanks, :slightly_smiling_face:

You need to convert date to UNIX.

You can use this code:

BLOCK:DateToUnixTime
LABEL:EXP
datetime = @EXPIRE
=> VAR @EXP
ENDBLOCK

BLOCK:CurrentUnixTime
LABEL:TIME
=> VAR @TIME
ENDBLOCK

BLOCK:Keycheck
banIfNoMatch = False
KEYCHAIN FAIL OR
INTKEY @TIME GreaterThan @EXP
KEYCHAIN SUCCESS OR
INTKEY @EXP GreaterThan @TIME
ENDBLOCK

1 Like

Hi,

Great!!! :slightly_smiling_face:

Thanks a lot