set thedate=%date:~6,4%-%date:~3,2%-%date:~0,2%
set thetime=%time:~0,2%%time:~3,2%
For Example: =%date:~6,4%
Outputs the date, then takes 4 characters from the 6th Character.
Depending on location: Date will show DD-MM-YYYY
Sp:
%date:~6,4% = YYYY
%date:~3,2% = MM
%date:~0,2% = DD

Time is shown: HH:MM:SS.SS
%time:~0,2%=HH
%time:~3,2%=MM