Semantically, you're probably looking for the one-liner

new Date().toLocaleString()

which formats the date in the locale of the user.

If you're really looking for a specific way to format dates, I recommend the moment.js library.

Answer from Andrew Mao on Stack Overflow
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date
Date - JavaScript | MDN
A JavaScript date is fundamentally specified as the time in milliseconds that has elapsed since the epoch, which is defined as the midnight at the beginning of January 1, 1970, UTC (equivalent to the UNIX epoch).
🌐
W3Schools
w3schools.com › jsref › jsref_obj_date.asp
JavaScript Date Reference
<a> <abbr> <address> <area> <article> <aside> <audio> <b> <base> <bdo> <blockquote> <body> <br> <button> <canvas> <caption> <cite> <code> <col> <colgroup> <datalist> <dd> <del> <details> <dfn> <dialog> <div> <dl> <dt> <em> <embed> <fieldset> <figcaption> <figure> <footer> <form> <head> <header> <h1> - <h6> <hr> <html> <i> <iframe> <img> <ins> <input> button <input> checkbox <input> color <input> date <input> datetime <input> datetime-local <input> email <input> file <input> hidden <input> image <input> month <input> number <input> password <input> radio <input> range <input> reset <input> sear
🌐
GitHub
github.com › olton-archive › DatetimeJS
olton-archive/DatetimeJS: Datetime.js is a minimalist ...
Datetime.js is a minimalist JavaScript library that parses, validates, manipulates, and displays dates and times for modern browsers with comfortable chainable modern API. - olton-archive/DatetimeJS
Starred by 5 users
Forked by 2 users
Languages   JavaScript 100.0% | JavaScript 100.0%
🌐
GitHub
github.com › olton › datetime
Datetime is a minimalist JavaScript library ...
Datetime is a minimalist JavaScript library that parses, validates, manipulates, and displays dates and times for Node and modern Browsers with a comfortable modern API. - olton/datetime
Author   olton
🌐
Timestamp Converter
timestamp-converter.com
Timestamp Converter
epoch/Unix timestamp converter into a human readable date and the other way around for developers.
Find elsewhere
🌐
W3Schools
w3schools.com › js › js_dates.asp
JavaScript Dates
February 4, 2026 - JavaScript stores dates as number of milliseconds since January 01, 1970.
🌐
Microsoft Developer
developer.microsoft.com › en-us › fluentui
Home - Fluent UI
The official front-end framework for building experiences that fit seamlessly into Microsoft 365.
🌐
jQuery UI
jqueryui.com › datepicker
Datepicker | jQuery UI
jQuery UI is a curated set of user interface interactions, effects, widgets, and themes built on top of the jQuery JavaScript Library. Whether you're building highly interactive web applications or you just need to add a date picker to a form control, jQuery UI is the perfect choice.
🌐
Phrase
phrase.com › home › resources › blog › what is the best javascript date and time library?
What Is the Best JavaScript Date and Time Library? | Phrase
January 7, 2025 - Datejs is an open-source JavaScript Date Library for parsing, formatting, and processing DateTime objects. It is a wrapper for the built-in JavaScript Date Constructor function with enhanced capabilities.
🌐
Simon Willison
til.simonwillison.net › javascript › javascript-date-objects
JavaScript date objects | Simon Willison’s TILs
Intl.DateTimeFormat() for even more advanced formatting options in the browser standards · Luxon - the more modern alternative to the no longer recommended Moment.js ... There's a new browser standard for JavaScript date operations coming in the future called Temporal, described in detail here
🌐
Home Assistant
home-assistant.io › docs › configuration › templating
Templating - Home Assistant
For example: precision = 1 could return “2 years” while precision = 2 could return “1 year 11 months”. This function can also be used as a filter. If the datetime is in the past, returns 0 seconds.
🌐
JavaScript.info
javascript.info › tutorial › the javascript language › data types
Date and time
Many JavaScript engines implement a non-standard method getYear(). This method is deprecated. It returns 2-digit year sometimes. Please never use it.
🌐
Twelve Data
twelvedata.com › docs
API Documentation - Twelve Data
Datetime at local exchange time referring to when the bar with specified interval was opened.
🌐
WFYI
wfyi.org › events › the-forsytes-series-premiere-screening
The Forsytes Series Premiere Screening
March 16, 2026 | Join WFYI on Monday, March 16 at 6:30 p.m. for your first look at The Forsytes, a brand-new show from MASTERPIECE.
🌐
Timestamp Converter
timestamp.online
Timestamp Converter
Convert timestamp to date or date to timestamp easily. Learn how to convert timestamp to date in Python, PHP, JavaScript, Bash, ...
🌐
Bugfender
bugfender.com › blog › javascript-date-and-time
The Definitive Guide to JavaScript Date and Time | Bugfender
February 18, 2025 - The above code will output “17/10/2023” when you run with en-US locale (language) and time zone IST (UTC+0530). When you need a localized date, you must explicitly pass it to the Intl.DateTimeFormat method.