[SOLVED] Sntax for using TODAY function in calculated field
Hi All. Sorry for what is probably a simple question but I can't find any documentation on this. I want to calculate the number of days between a date on my database and the current date. My db date is a date time field so I used HDATE to convert this. Then I wanted to use DATEDIF to get the number of days between that date and the current date but the only way I could see of getting the current date was the TODAY function. However I put this into the DATEDIF function I get an error, usually along the lines of invalid argument for TODAY.
Can anyone help please? Thank you...This message has been edited. Last edited by: <Kathryn Henning>,
Release 8 Windows 7 Excel/HTML/PDF Oracle 11g
March 02, 2014, 08:50 PM
StuBouyer
The problem iwth TODAY is that it returns an string representation of the date, which DATEDIF doesn't like.
I usually use the following:
DDFIF/I9 = DATEDIF('&YYMD', ORDER_DATE, 'Y');
OR
DDFIF/I9 = DATEDIF('&DATEYYMD', ORDER_DATE, 'Y');
Regards
Stuart
WebFOCUS 8.2.03 (8.2.06 in testing)
March 03, 2014, 03:27 PM
LTaylor
Hello - Perhaps this will help? The first set statement is used in an include member and may need a little reworking for this purpose...
Production: WebFocus 8.0.09 Test: WebFocus 8.0.09 Windows, Z-Linux, and ZOS. all output Focus - 7.2.7
June 04, 2014, 04:28 AM
tcox
Thanks for the replies. I checked both methods and could use either, but the requester decided they could do without that field on the report this time so I haven't had to choose. At least I'll know for next time...