In ZSH I use parameter expansion like this:
echo ${(%):-%D{%d.%m.%y-%H:%M:%S}}
Here
(%) turns on parameter expansion:- sets string literal for expansion rather than a variable%D{%d.%m.%y-%H:%M:%S} this evaluates to the date according to the parameter expansion