Printer Version Table of Contents Project Home Page
.EXAMPLE.....: 52 Represent a date in a short (4-byte) format (technique #2)
.CATEGORY....: examples
.DISCUSSION..:
This batch file shows how to use Fdate's #2XX function to obtain and represent today's date in 4 characters, YYMD, where:

You can also use Fdate's "XXX" output format to represent dates between 1990 and 2024 in 3 bytes of extended hex notation.

.CODE........:
@echo off
cls

:: OBTAIN 1-CHARACTER REPRESENTATION FOR THE MONTH
Fdate /Ff    /Omm   /Vmm
Fdate /f#2xx /A%mm% /Vmm
echo XX representation of this month's number      is %mm%

:: OBTAIN 1-CHARACTER REPRESENTATION FOR THE DAY
Fdate /Ff    /Odd   /Vdd
Fdate /f#2xx /A%dd% /Vdd
echo XX representation of today's day of the month is %dd%

:: CONCATENATE THEM TO THE 2-CHARACTER REPRESENTATION FOR THE YEAR
Fdate /Ff /Oyy /S%mm%%dd% /Vdate
echo XX representation of today's full date        is %date%

:: CLEANUP
set mm=
set dd=
set date=

:endit