YYYYMMDD.TXT - Display Date

Last updated 2008-02-08 by Roedy Green

GETTING THE LATEST VERSION
**************************

You can find the latest CMP utilities via my home page at:
http://mindprod.com/products.html

PURPOSE
*******

Displays the current date in the form YYYY/MM/DD.

This date can redirected to a file to embed that date is a file.

COMMAND LINE
************

An Optional separator can be put on the command line.

e.g. if you wanted ISO 8601:1988 international standard
yyyy-mm-dd format:
     YYYYMMDD -
       gives 2000-12-31

     YYYYMMDD none
       gives 20001231

     YYYYMMDD space
       gives 2000 12 31

     YYYYMMDD .
       gives 2000.12.31

That separator can be put in a set variable, e.g.

SET SEP="-"

YYYYMMDD %SEP%

PIPING
******

You can send the output of YYYYMMDD to a file with:

YYYYMMDD.com > MyFile.Txt

You can use it to rename files to embed the date in the filename. Here's
how:

1. Put today's date in a file with:

     YYYYMMDD none > Today.bat.

   The file will look like:

     20011231(no cr)

2. Create a file called head.bat that looks like this:
   set date=(no Cr)

3. Create a file called tail.bat that looks like this:

    (Cr)
    rename backup.log backup_%date%.log(Cr)

4. Construct a bat file out of three pieces. Head.bat Today.bat Tail.bat
   with:

     copy Head.bat + Today.bat + Tail.bat DoIt.bat

5. The DoIt.bat file now looks like this:

     set date=20011231
     rename backup.log backup_%date%.log

If you use 4DOS or 4NT, you can do it even more elegantly with the CMP SA!
utility and the >> and >  redirection.

Freeware Status
****************

YYYYMMDD, YYMMDD and HHMM are freeware.  If you have problems contact

Roedy Green
Canadian Mind Products
#101 - 2536 Wark Street
Victoria, BC V8T 4G8
tel:(250) 361-9093

mailto:roedyg@mindprod.com
http://mindprod.com

Make sure you have the latest version from http://mindprod.com/products.html

-30-