date manipulation crashing when month is feb
Posted: Thu Apr 29, 2021 11:06 am
Hi all,
This piece of code works for any month, except feb (i..e if the @dateadd determines any month other than feb, it will correctly return the requested date string. But for Feb it returns "?". And unfortunately, Feb is the month I need to assign the string to. Any thoughts?
Thanks!
Bob
This piece of code works for any month, except feb (i..e if the @dateadd determines any month other than feb, it will correctly return the requested date string. But for Feb it returns "?". And unfortunately, Feb is the month I need to assign the string to. Any thoughts?
Thanks!
Bob
Code: Select all
close @wf
wfcreate(wf=test) m 2016 2016
!dom=@datepart(@dateval(@date),"dd")
if !dom > 10 then
%enddate = @datestr(@dateadd(@dateval(@date),-2,"mm"),"yyyy")
statusline check ok
else
%enddate = @datestr(@dateadd(@dateval(@date),-3,"mm"),"mm/dd/yyyy")
statusline check bad
endif
show %enddate