How to calcdate in formato MMDDYYYY

All questions about Control-M jobs definitions
Post Reply
User avatar
th_alejandro
Nouveau
Nouveau
Posts: 188
Joined: 26 Nov 2008 12:00
Location: Bogotá

How to calcdate in formato MMDDYYYY

Post by th_alejandro » 16 Apr 2012 8:43

How can I obtain a MMDDYYYY var format using calcdate ?

for example, today is 20120416 and i use a CALCDATE to return the last day of the previous month as PARM1 %%$CALCDATE %%$DATE - %%$DAY, CTM returns 20120331, but i need this date in format MMDDYYYY. Any idea ?

Currently, i must take this date and convert in the script code from YYYYMMDD to MMDDYYYY, but i think it's very nice if this variable pass as needed.

Thanks. 8O

User avatar
brownbag
Nouveau
Nouveau
Posts: 161
Joined: 11 Oct 2007 12:00
Location: Melbourne

CALCDATE IN FORMAT MMDDYYYY

Post by brownbag » 17 Apr 2012 5:03

You need to do the following
%%YYYY = %%SUBSTR %%YYYYMMDD_DATE 1 4
%%MM = %%SUBSTR %%YYYYMMDD_DATE 5 2
%%DD = %%SUBSTR %%YYYYMMDD_DATE 7 2
%%PARM1 = %%DD.%%MM.%%YYYY

Post Reply