Update: Now that it\'s 2016 I\'d use PowerShell for this unless there\'s a really compelling backwards-compatible reason for it, particularly because of the regional setting
I know that there are numerous ways mentioned already. But here is my way to break it down to understand how it is done. Hopefully, it is helpful for someone who like step by step method.
:: Check your local date format
echo %date%
:: Output is Mon 08/15/2016
:: get day (start index, number of characters)
:: (index starts with zero)
set myday=%DATE:~0,4%
echo %myday%
:: output is Mon
:: get month
set mymonth=%DATE:~4,2%
echo %mymonth%
:: output is 08
:: get date
set mydate=%DATE:~7,2%
echo %mydate%
:: output is 15
:: get year
set myyear=%DATE:~10,4%
echo %myyear%
:: output is 2016