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 Web Docs - Mozilla
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
🌐
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.
🌐
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.
🌐
W3Schools
w3schools.com › js › js_dates.asp
JavaScript Dates
February 4, 2026 - JavaScript stores dates as number of milliseconds since January 01, 1970.
🌐
Mozilla
developer.mozilla.org › en-US › docs › Web › JavaScript › Guide › Representing_dates_times
Representing dates & times - JavaScript - MDN Web Docs
JavaScript does not have a date data type. However, you can use the Date object and its methods to work with dates and times in your applications. The Date object has a large number of methods for setting, getting, and manipulating dates. It does not have any properties.
Find elsewhere
🌐
Toptal
toptal.com › software › definitive-guide-to-datetime-manipulation
How to get the Timestamp And Date in Javascript: JS DateTime | Toptal®
January 16, 2026 - It offers convenient methods to get the current time in JavaScript, store a date in a variable, perform date arithmetic, and format the date based on the user’s locale. Due to differences between browser implementations and incorrect handling of Daylight Savings Time (DST), depending on the Date object for mission-critical applications is not recommended and you should probably be using a DateTime library like Luxon, date-fns, or dayjs.
🌐
date-fns
date-fns.org
date-fns - modern JavaScript date utility library
date-fns provides the most comprehensive yet simple and consistent toolset for manipulating JavaScript dates in a browser & Node.js.
🌐
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.
🌐
DEV Community
dev.to › raaynaldo › javascript-datetime-111e
📅 Javascript Datetime 📅 - DEV Community
March 31, 2022 - I also want to share this DateTime converter that I found helpful for my work. https://www.timestamp-converter.com/ In this section, I will cover the most popular Javascript Date that most people use.
🌐
Reddit
reddit.com › r/webdev › how do we work with the date and datetime in js?
r/webdev on Reddit: How do we work with the date and datetime in JS?
December 14, 2021 -

As far as I know the database stores the datetimes in UTC format.

We have some datepickers and datetimepickers, we want to show the exact time and date the user selected, no matter where the user is, so we don't care about timezones, however when parsing the dates, such as

let date = new Date('2021-12-14')

Sometimes it'll parse as December 13th instead of 14th depending on my timezone.
How can I parse it without caring about the timezone, and how should I send it to the backend?

As I said this is completely timezone-agnostic, I just want to keep the exact correct date, same applies with the time for timepickers, I don't want to convert to local, I just want to keep the exact time the user selected for everything.

🌐
GeeksforGeeks
geeksforgeeks.org › javascript › javascript-date
JavaScript Date - GeeksforGeeks
The JavaScript Date object represents a specific moment in time, measured in milliseconds since the Unix Epoch (January 1, 1970).
Published   July 11, 2025
🌐
GitHub
github.com › olton › datetime
GitHub - olton/datetime: 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.
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
🌐
Programiz
programiz.com › javascript › date-time
JavaScript Date and Time
July 6, 2020 - A JavaScript date defines the EcmaScript epoch that represents milliseconds since 1 January 1970 UTC.
🌐
DigitalOcean
digitalocean.com › community › tutorials › understanding-date-and-time-in-javascript
Understanding Date and Time in JavaScript | DigitalOcean
August 25, 2021 - JavaScript comes with the built in Date object and related methods. This tutorial will go over how to format and use date and time in JavaScript.
🌐
Medium
medium.com › @AlexanderObregon › handling-dates-and-times-in-javascript-8b62091f2e74
JavaScript Date and Time Handling | Medium
June 30, 2024 - Learn how to handle dates and times in JavaScript using the Date object, Moment.js, and other modern libraries. Follow best practices for better code.
🌐
Mozilla
developer.mozilla.org › en-US › blog › javascript-temporal-is-coming
JavaScript Temporal is coming - MDN Web Docs
The major issues with JavaScript's Date object are that it only supports the user's local time and UTC, and there's no time zone support. Additionally, its parsing behavior is very unreliable, and Date itself is mutable, which can introduce hard-to-trace bugs.
🌐
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