Why not use <@fmt.formatDate … > or one of the freemarker builtins?
https://freemarker.apache.org/docs/ref_builtins_date.html