You can write down a function, can take a look for it I have it somewhere in my code however the more easy is use a node called moment, is what I’m using most frequently.
I’m using this on several ways and make a global set of the formatted date, then on any function u can directly recall the global variable and get the date formatted directly as u wish.
Regards