echo %DATE%Your system will respond in the manner in which it's configured based on date format and localization.
My system responds with:
Tue 05/14/2019To disect this data use:
SET TDATE=%DATE:~10,4%%DATE:~7,2%%DATE:~4,2%
This can be used later like so:
SET FILENAME=EFSSTATS_%TDATE%
To decipher the work, %DATE:~10,4% takes 4 characters starting at position 10:
1 2 3 4 5 6 7 8 9 A B C D E F
------------------------------
T u e 0 5 / 1 4 / 2 0 1 9
The same can be applied to %DATE:~7,2% and %DATE:~4,2% for logic's sake.
The Caveat (updated 2020-12-14):
Localization will be the undoing of this functionality but Powershell is the solution. When you're in a global environment this is a better choice.
FOR /F "usebackq delims=" %a in...
(`powershell -C "$(Get-Date).ToString('yyyy-MM-dd')"`) do SET today=%a
Then you can use it:
ECHO %today%
Result:
2020-12-14
To go a little further you can create a precise timestamp by using:
'yyyy-MM-ddTHHMMss' which gives me (now ~ GMT) 2020-12-14T033429.
Explore your options. Localization is easier with Powershell, but not infallible.