Thread: [Solved] Adding months to a Date
View Single Post
 
Old 09-28-2011, 03:20 AM
tsindos tsindos is offline Windows 7 32bit Office 2010 32bit
Novice
 
Join Date: Sep 2011
Posts: 3
tsindos is on a distinguished road
Unhappy Adding months to a Date

I have found the following piece of code on the Internet and used it fine on my previous computer. Now that I changed computer, I cannot get it to work. I have not found anything relating to this in past threads in this forum.

The Idea is to add 36 (Delay) months to a date entered (StartDate).

The code is:

{QUOTE
{SET mm{=MOD(ABS({StartDate \@ M}+Delay+11);12)}}
{SET yy{=INT({StartDate \@ yyyy}+(Delay+{StartDate \@ m}-1)/12)}}
{SET dd{=IF(({StartDate \@ d}>28)*({mm \@ M}=2)=1;28+((MOD(yy;4)=0)+(MOD(yy;400)=0)-(MOD(yy;100)=0));
IF(({mm \@M}=4)+({mm \@ M}=6+({mm \@ M}=9)+({mm \@ M}=11)+({StartDate \@ d}>30)>1;30;{StartDate \@ d}))}}
{IF{={IF{={StartDate \@ “dddd”}}=”!*” 0 1}+{IF{={StartDate \@ “MMMM”}}= “!*” 0 1}+{IF{a}=”!*” 1 0}+{IF{=Delay}=”{Delay}” 0 1}}=0
{QUOTE “{dd}-{mm}-{yy}” \@ “dddd, d MMMM yyyy”}.” “Data entry error!”}}

Can anyone help me figure out what I am doing wrong?

Thank you.
Reply With Quote