Friday, January 5, 2018

Get formatted date in a batch file.

SET mm=%DATE:~4,2%   -  This moves 4 positions and gets the next 2 positions.
SET dd=%DATE:~7,2%     -  This moves 7 positions and gets the next 2 positions.
SET yyyy=%DATE:~10,4% -  This moves 10 positions and gets the next 4 positions.

Output it in a script
%yyyy%.%mm%.%dd%

No comments:

Post a Comment

Thank you for your comment.