Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Retrieving the system date in MMDDYY format 1

Status
Not open for further replies.

DayLaborer

Programmer
Jan 3, 2006
347
US
How can I get the two digit year from the command line?

The closest I've come is:
Code:
FOR /F "TOKENS=1,2,3,4 DELIMS=/ " %A IN ('DATE/T') DO SET TEMPYEAR2=%B%C%D
but that returns
10032006
and I would like only
100306

Thanks!
 
...if this is the wrong forum:
(1) my apologies, and
(2) kindly point me to the correct forum for this question.

Thanks!
 
Use:

%date:~-2%

For example:
Set mm=%date:~4,2%
Set dd=%date:~7,2%
Set yy=%date:~-2%
Set yyyy=%date:~-4%
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top