D
Diane
From this forum, I was able to find a script that will subtract one month
from the current date for a "date field" in my document.
Script:
{QUOTE}
{SET Delay 4}
{SET m{ =mod({ DATE \@ MM } -Delay +11,12) +1}}
{SET y{=INT({ DATE \@yyyy} + (Delay + { DATE \@ M } -1) /12 }}
"{ m }-{ y}" \@ "MMMM yyyy"}
The script works, but I do not understand what exactly line 3, the "SET M"
is doing at the part of "11,12) +1. I understand it takes current month and
subtracts 4 months in my example, but then what is the +11,12) +1 doing?
My second problem is, as in this example, I am subtracting four months,
which should give me, December 2006 - instead, I get December 2007. The year
does not calculate based on the month. Although, when I test adding 23
months, versus subtracting 4 months, then my year adjusts correctly; it's
somewhere in the subtracting that I'm having an issue with. All I need/want
is to subtract one month from the current month, but if that month is
January, the year needs to adjust as well.
Any clarification on this script would be appreciated!
Diane
from the current date for a "date field" in my document.
Script:
{QUOTE}
{SET Delay 4}
{SET m{ =mod({ DATE \@ MM } -Delay +11,12) +1}}
{SET y{=INT({ DATE \@yyyy} + (Delay + { DATE \@ M } -1) /12 }}
"{ m }-{ y}" \@ "MMMM yyyy"}
The script works, but I do not understand what exactly line 3, the "SET M"
is doing at the part of "11,12) +1. I understand it takes current month and
subtracts 4 months in my example, but then what is the +11,12) +1 doing?
My second problem is, as in this example, I am subtracting four months,
which should give me, December 2006 - instead, I get December 2007. The year
does not calculate based on the month. Although, when I test adding 23
months, versus subtracting 4 months, then my year adjusts correctly; it's
somewhere in the subtracting that I'm having an issue with. All I need/want
is to subtract one month from the current month, but if that month is
January, the year needs to adjust as well.
Any clarification on this script would be appreciated!
Diane