JSI Tip 6837. How do I convert the current month to an environment variable containing a 3 character month abbreviation?

Jerold Schulman

June 11, 2003

1 Min Read
ITPro Today logo in a gray background | ITPro Today

I have scripted MMM.bat to return the 3 character abbreviation of the current month to a call directed environment variable.

The syntax for using MMM.bat is:

call mmm yourvariable

NOTE: MMM.bat calls univdate.bat.

MMM.bat contains:

@echo off
if {%1}=={} @echo Syntax: call MMM Month&goto :EOF
setlocal
set montab=XXXJANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC
call univdate
set /a mm=(100%mm%%%100) * 3
call set month=%%montab:~%mm%^,3%%
endlocal&set %1=%month%



Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like