Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Compare timestamp with time(now)

Hi

I have a updatefield with timestamp of last update. 'YYYY-MM-DD hh:mm:ss'

For a IF expresseion that checks if the script should continue I need it to check if the timestamp are larger/later then 20:00 (8 pm) yesterday.

How should I do that check?

1 Solution

Accepted Solutions
MarcoWedel

If(TimestampLastUpdate > DayStart(Today())-1/6, dosomething, dosomethingelse)

View solution in original post

7 Replies
MK_QSL
MVP
MVP

Let vTime = Time(Frac(Timestamp('$(vLastReloadTime)')),'hh:mm');

IF (vTime >= Time#('20:00','hh:mm')) THEN

YOURSCRIPT.....

ELSE

ENDIF

Let vLastReloadTime = ReloadTime();

Not applicable
Author

Thank you. but I also need to check that the date is a maximum of one day back in time. It is to be approved is one day back but at least 20:00 or today's date (regardless of time)

MK_QSL
MVP
MVP

Can you elaborate little more pls?

MK_QSL
MVP
MVP

Let vReLoadDate = Date(Floor(Timestamp('$(vLastReloadTime)')));

Let vTime = Time(Frac(Timestamp('$(vLastReloadTime)')),'hh:mm');

IF(vReloadDate < Date(Today())) THEN

     YourScript

ELSE

IF (vTime >= Time#('12:00','hh:mm')) THEN

     YourScript

ENDIF

Let vLastReloadTime = ReloadTime();

Not applicable
Author

I will try...

The qvw script runs on three occasions during the period between 03:00 and 12:00 and I want to cancel it if the db is not updated. The db should be updated every night. Sometimes it goes quickly and then field UdpUpdate is = TODAY()-1 and Time> 20:00.

At the end of the month it goes a little slower and then the update sometimes are dealyed and are to be completed TODAY() from 00:00 onwards.

I just want the script to check if the field UdpUpdate shows a higher value than yesterday's date and time > 20:00 or and aslo date(today())

MarcoWedel

If(TimestampLastUpdate > DayStart(Today())-1/6, dosomething, dosomethingelse)

Not applicable
Author

Thanks. It shoudl work but I cant get it to work.. I have atteaced a sample with the latest timestamp check from the db