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

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%



Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish