DEV Community

Discussion on: Handling Dates in JavaScript

Collapse
 
osde8info profile image
Clive Da

you might also like to have a look at the JS date and time formatting functions

new Date().toLocaleDateString("en-GB", options);
new Date().toLocaleTimeString("en-GB")

Collapse
 
aumayeung profile image
John Au-Yeung

toLocaleDateString actually has lots of options to format dates.

It's also sensitive to locale, which is handy for formatting dates in any format in the world almost.