Printer Version Table of Contents Project Home Page
.EXAMPLE.....: 19 "Roll your own" date format
.CATEGORY....: examples
.DISCUSSION..:
.CODE........:
@echo of
cls
:: EXAMPLE A: create a date in the format of the DOS "date" command
:: format, followed by the DOS "time" command format

:: get the three-character day-of-week name
Fdate /Ff /Odow3 /Vx

:: add mm-dd-ccyy to it
Fdate /Ff /Omm-dd-ccyy /p"%x% " /Vx

:: add the DOS "time" format (new output format in Fdate 8.6)
Fdate /Ff /Otdos       /p"%x% " /Vx
echo Date/time = %x%

:: EXAMPLE B: create a date in custom-made format: yymn3dd
Fdate /Ff /Oyy          /Vx
Fdate /Ff /Omn3 /P"%x%" /Vx
Fdate /Ff /Odd  /P"%x%" /Vx
echo Today is %x%

:: EXAMPLE C: create a date with day and month date-parts right justified
::            and padded with spaces, such as " 1- 1-1995" for Jan 1, 1995
Fdate /Ff /ozd   /j"R 2" /vzd
Fdate /Ff /ozm   /j"R 2" /vzm
Fdate /Ff /occyy /p"%zd%-%zm%-"  /v
echo Today is [%fdate%]