Discussion board where members can get started with Qlik Sense.
I want to compare two dates which are coming as strings in db
I created a flag field for comparing the times which is
if (timestamp(SCHEDULE_TIME,'h:mm TT') > (timestamp(Timestamp(now(0)-30/(24*60)),'h:mm TT')),1)
but every time I am getting the flag value as 1.
but ideally I should get flag as 0 for 9 AM entry.
or if you SCHEDULE_TIME is read as time, may be this:
If(SCHEDULE_TIME > Frac(Now(0)) - (1/48), 1, 0)
If(Frac(SCHEDULE_TIME) > Frac(Now(0)) - (1/48), 1, 0)
If(Frac(TimeStamp#(SCHEDULE_TIME, 'h:mm TT')) > Frac(Now(0)) - (1/48), 1, 0)
Thanks a ton..it worked
Just a request..can you please explain the logic you implemented.
like when I am doing a frac on the load time i.e below
I am getting
Also if you can please explain why you have subtracted 1/48.
Try like this, you should use Timestamp#() to convert String to DateTime format.
if (Timestamp#(SCHEDULE_TIME,'h:mm TT') > Timestamp(Now(0)-(1/48)),1, 0)
Hope this helps you.
So Frac is the time component of your complete date. If you add Time(Frac(Now(0))) you will see the current time for today's date.
With regards to 1/48, you were subtracting 30/24*60 and I just simplified this equation down to 1/48.