Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
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.
Kindly help.
May be try like this:
If(TimeStamp#(SCHEDULE_TIME, 'h:mm TT') > Frac(Now(0)) - (1/48), 1, 0)
or if you SCHEDULE_TIME is read as time, may be this:
If(SCHEDULE_TIME > Frac(Now(0)) - (1/48), 1, 0)
or
If(Frac(SCHEDULE_TIME) > Frac(Now(0)) - (1/48), 1, 0)
or
If(Frac(TimeStamp#(SCHEDULE_TIME, 'h:mm TT')) > Frac(Now(0)) - (1/48), 1, 0)
Hi Sunny,
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.
Thanks,
Aniruddhya
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.
Regards,
Jagan.
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.
Hi Sunny,
Thanks for you detailed reply.Thanks a ton for helping me out.
Thanks,
Aniruddhya
Hi jagan,
Thanks a ton.The option you provided do worked.
Thanks,
Aniruddhya
If you got the answer close this thread by giving correct and helpful answers to the posts which helped you..
Regards,
Jagan.
Hi Aniruddhya,
Close this thread by giving Correct Answer if you got the answer.
Regards,
Jagan.