In tip 4835, I parsed today's date for any NT-based operating system.

In tip 6837, I returned the 3 character abbreviation for the current month.

I have scripted Today.bat to return today's numeric month, day, and year, the 3 character month abbreviation, and the 2 digit month and day.

The syntax for using Today.bat is:

call today MMn DDn YYn Abrev MM DD

Where:

<b>MMn</b>   is a <a href="/article/jsifaq/jsi-tip-5535-how-can-i-cause-a-called-batch-file-to-return-a-call-directed-environment-variable-.aspx">call directed <b>numeric</b> environment variable</a> that will contain today's month.
<b>DDn</b>   is a <a href="/article/jsifaq/jsi-tip-5535-how-can-i-cause-a-called-batch-file-to-return-a-call-directed-environment-variable-.aspx">call directed <b>numeric</b> environment variable</a> that will contain today's day.
<b>YYn</b>   is a <a href="/article/jsifaq/jsi-tip-5535-how-can-i-cause-a-called-batch-file-to-return-a-call-directed-environment-variable-.aspx">call directed <b>numeric</b> environment variable</a> that will contain today's 4 digit year.
<b>Abrev</b> is a <a href="/article/jsifaq/jsi-tip-5535-how-can-i-cause-a-called-batch-file-to-return-a-call-directed-environment-variable-.aspx">call directed environment variable</a> that will contain today's 3 character month abbreviation.
<b>MM</b>    is a <a href="/article/jsifaq/jsi-tip-5535-how-can-i-cause-a-called-batch-file-to-return-a-call-directed-environment-variable-.aspx">call directed environment variable</a> that will contain today's 2 digit month.
<b>DD</b>    is a <a href="/article/jsifaq/jsi-tip-5535-how-can-i-cause-a-called-batch-file-to-return-a-call-directed-environment-variable-.aspx">call directed environment variable</a> that will contain today's 2 digit day.

Example:

If today was January 3, 2005, then call today MMn DDn YYn Abrev MM DD would set:
<b>MMn</b>   to <b>1</b>
<b>DDn</b>   to <b>3</b>
<b>YYn</b>   to <b>2005</b>
<b>Abrev</b> to <b>Jan</b>
<b>MM</b>    to <b>01</b>
<b>DD</b>    to <b>03</b>
Today.bat contains:
@echo off
if \{%6\}==\{\} @echo Syntax: Today MMn DDn YYn Abrev MM DD&goto :EOF
setlocal
set vb="%temp%\today_%RANDOM%.vbs"
echo D = Now : MN = MonthName(Month(D), True)  >%vb%
echo WScript.Echo MN ^& " " ^& Month(D) ^& " " ^& Day(D) ^& " " ^& Year(D) >>%vb%
for /f "tokens=1-4" %%a in ('cscript.exe //Nologo %vb%') do (
 set abrev=%%a
 set /a MMn=100%%b%%100
 set /a DDn=100%%c%%100
 set /a YYn=10000%%d%%10000
)
del /q %vb%
if %YYn% LSS 1000 set /a YYn=%YYn% + 2000
set /a MM=%MMn%
set /a DD=%DDn%
if %MM% LSS 10 set MM=0%MM%
if %DD% LSS 10 set DD=0%DD%
endlocal&set %1=%MMn%&set %2=%DDn%&set %3=%YYn%&set %4=%abrev%&set %5=%MM%&set %6=%DD%