Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

force today() to return a date in the past

Hello ,

Am testing my QV app and hence need to force the function today() which I have used to calculate MTD and YTD numbers to a date in the past.

Is the only way to achieve this is set the OS date or is there any other trick ?

TIA

Lav

2 Replies
swuehl
MVP
MVP

I don't know any other way then setting the OS date and time to another value to directly affect the today() call.

But you can replace all your today() function calls with a variable vToday, then set the variable in default mode to today() and to any other date using makedate() when testing.

muniyandi
Creator III
Creator III

Hi Ram,

Use  Variable in script mode;

Let vToDay= Date(Today()-1,'DD/MM/YYYY')

Without script : Create a variable vToDay

= Date(Today()-1,'DD/MM/YYYY')