Page 1 of 1

@dateadd error

Posted: Mon Jan 29, 2018 1:37 am
by ErikG

Code: Select all

WfCreate C:\temp\temp.wf1 m 1980 2020
!da = @DateAdd(736722,1,"mm")
@UiPrompt(@Str(!da))


Returns NA

Other numbers such as 3000 work fine.

Eviews 10 jan 17 2018 build

Regards
/Erik

Re: @dateadd error

Posted: Mon Jan 29, 2018 2:01 am
by ErikG
I now see that this has to do with the current date: 29th of january. Since the 29th of february does not exist, @dateadd returns NA. I will write up a workaround:

Code: Select all

If !da = Na Then
   !da = @DateAdd(736722,15,"dd")
EndIf

Re: @dateadd error

Posted: Wed Jan 31, 2018 10:01 am
by dman
Ran into a similar issue today 01/31/2018.
I'm not adding days, but subtracting them off @now. As long as the target month is 31-days long it works. For 30-day months it doesn't.

Code: Select all

@datestr(@dateadd(@dateval("1/31/2018"),-4,"mm"),"yyyy[q]q")

results in "?"

substituting -4 to -1 (so that the result is December'17) works.


Seems like a bug alright.

Re: @dateadd error

Posted: Wed Jan 31, 2018 10:19 am
by EViews Gareth
Not a bug - same issue as before.

You're taking 4 months from January 31st. That equals September 31st. There is no such thing as September 31st, so the result is not available.