You can use the toLocaleDateString
function on a Date
object to display today's date in the desired format. Here's an example:
index.ts214 chars6 lines
In the options
object, you can customize the output by specifying which date components you want to include (month
, day
, year
) and their format (short
, long
, numeric
, etc.).
You can adjust the en-US
argument to display the output in a different locale.
gistlibby LogSnag