Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

How to format the date in DOS

Options
  • 01-07-2004 11:31am
    #1
    Closed Accounts Posts: 2,585 ✭✭✭


    When I type the "date /t" command, DOS returns 01/07/2004.

    I want to use this date to create a directory in a DOS script so I need it in the format YYMMDD (040701).

    Does anybody know how to format the output of the date command?

    Thanks.


Comments

  • Registered Users Posts: 21,264 ✭✭✭✭Hobbes


    try

    HELP SET

    if I recall correctly you can do something like this..


    > echo %DATE:~6,4%%DATE:~3,2%%DATE:~0,2%
    20040701


  • Closed Accounts Posts: 2,585 ✭✭✭HelterSkelter


    Thanks a million Hobbes, that worked nicely.


Advertisement