February 05, 2007, 08:29 AM
manashFocus - date computation
It might be a simple query, but due to lack of manual i am facing this problem, moreover i m using focus for first time, so can anyone help.
I have a date field in the input file in the format YMD and I need to add one year to it
what i did is:
define file f1
newdate/ymd=olddate +365
but how do i handle leap years in this case.
can there be other simple way of adding one year to input date field which takes care of the leap year.
February 05, 2007, 09:19 AM
codermonkeyThere's a DATEADD function:
NEWDATE/YMD = DATADD(OLDATE, 'Y', 1);
Since you have a web connection you can go to the IB tech support website and download manuals for additional info.
February 05, 2007, 09:22 AM
FrankDutchthe manuals can be downloaded in PDF. very good to use that you can search in teh manual first.
but here is the answer
DATEADD(OLDDATE, 'Y', 1)
and you can understand what it would be if you want to add a month or a day or want to substract a day or a month or a business day.
good luck