Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all.
How can i get yesterdays date in my SQL (AS400)
In my app i have:
Let ExecutionTime = date(now()-1);
But i'ts doesent work, i have to load the app 2 times to get yesterdays date.
Mayby a Macro can work? Before loading?
Now function will give you Timestamp also, so make sure you are picking up the date part of it.
Hi,
Use the Today() function instead of Now(). Today() doesn't have any time portion so there should be no confusion.
Regards,
Stephen
Hi all.
I've tried but i think we have to initiate yesterdays day before i loading the SQL script?
First in my script:
Let ExecutionTime = date(today()-1)
Then my SQL:
Select bla, bla from table where date = '$(ExecutionTime )';
When the sript reload tomorrow i have today's date in variable ExecutionTime
I apologize in advance..I might sound like an idiot here but when you say that tomorrow it will have today's date, isn't that correct? Or it it one off all the time?
In that case I would suggest checking the system clock/calendar settings. Sounds like you would get the "correct" result with today()-2 but there has to be an underlying reason for why it picks the wrong date for you from the get go.
Hi,
It's the point to show yesterdays numbers in my report when you viewing the report today. I'll have to reload the qv evrey morning at six.
I suggest always using an explicit parameter like today(1) and now(1). The defaults are different between the two functions, and the behavior is different between script and chart usage (and release 7 to releae 8 as well).
Try today(1)-1;
-Rob