I hope this is what you want:
const today = new Date();
const yyyy = today.getFullYear();
let mm = today.getMonth() + 1; // Months start at 0!
let dd = today.getDate();
if (dd < 10) dd = '0' + dd;
if (mm < 10) mm = '0' + mm;
const formattedToday = dd + '/' + mm + '/' + yyyy;
document.getElementById('DATE').value = formattedToday;
How do I get the current date in JavaScript?
Answer from Aelios on Stack OverflowfreeCodeCamp
freecodecamp.org › news › javascript-date-now-how-to-get-the-current-date-in-javascript
JavaScript Date Now – How to Get the Current Date in JavaScript
June 15, 2020 - It returns the value in milliseconds that represents the time elapsed since the Epoch. You can pass in the milliseconds returned from the now() method into the Date constructor to instantiate a new Date object:
Top answer 1 of 7
721
I hope this is what you want:
const today = new Date();
const yyyy = today.getFullYear();
let mm = today.getMonth() + 1; // Months start at 0!
let dd = today.getDate();
if (dd < 10) dd = '0' + dd;
if (mm < 10) mm = '0' + mm;
const formattedToday = dd + '/' + mm + '/' + yyyy;
document.getElementById('DATE').value = formattedToday;
How do I get the current date in JavaScript?
2 of 7
250
I honestly suggest that you use moment.js. Just download moment.min.js and then use this snippet to get your date in whatever format you want:
<script>
$(document).ready(function() {
// set an element
$("#date").val( moment().format('MMM D, YYYY') );
// set a variable
var today = moment().format('D MMM, YYYY');
});
</script>
Use following chart for date formats:

Videos
06:19
NO LIBRARIES REQUIRED: Format Date Time in JavaScript Tutorial ...
18:02
The Date Object - Getting, Setting & Formatting Dates in JavaScript ...
11:59
The Easiest Way to Format Dates in JavaScript - YouTube
01:00
How To Easily Format Dates In JavaScript - YouTube
16:02
Format Your Own Dates With JavaScript - YouTube
02:28
How to format a date in JavaScript? - YouTube
freeCodeCamp
freecodecamp.org › news › how-to-format-a-date-with-javascript-date-formatting-in-js
How to Format a Date with JavaScript – Date Formatting in JS
November 7, 2024 - Using Intl.DateTimeFormat, you can specify the desired locale and various options to format dates precisely as needed. There are more options you can use in the official documentation. When working with dates, it's essential to consider time zones, especially when dealing with global applications or time-sensitive information. JavaScript provides methods to handle time zones effectively:
Bugfender
bugfender.com › blog › javascript-date-and-time
The Definitive Guide to JavaScript Date and Time | Bugfender
February 18, 2025 - timeago.js: timeago.js is a lightweight(~2KBs) nano library used to format date and time with *** time ago statement (e.g.: ‘2 hours ago’). It has support for React, Python, and plain JavaScript. ... Are you also working with Swift? Improve your iOS development skills by reading our detailed guide on Date Manipulation in Swift, tailored for advanced developers. Mastering Swift Date Operations: A Comprehensive Guide for iOS Developers · You must have realized by now that the JavaScript Date object is vast.
GeeksforGeeks
geeksforgeeks.org › javascript › javascript-date-now-method
JavaScript Date now() Method - GeeksforGeeks
July 11, 2025 - JavaScript · // Use of Date.now() method let d = Date(Date.now()); // Converting the number of millisecond in date string a = d.toString() // Printing the current date console.log("The current date is: " + a) Output · The current date is: Sat Jul 13 2024 20:59:57 GMT+0000 (Coordinated Universal Time) The code snippet generates a new Date object using the current timestamp from Date.now(). It then converts this date object to a string format using .toString() and logs it, displaying the current date and time.
Codecademy
codecademy.com › article › javascript-date-format
How to Format a Date in JavaScript | Codecademy
To get a Date object for a specific date, we can pass the date as a string to the Date() constructor. ... You can pass the input date string to the Date() constructor in other formats as well, such as January 14, 2025 or 2025-01-14.
GeeksforGeeks
geeksforgeeks.org › javascript › how-to-format-javascript-date-as-yyyy-mm-dd
How To Format JavaScript Date as yyyy-mm-dd? - GeeksforGeeks
June 24, 2025 - We use JavaScript built-in help methods from the Date class that help us to create a formatted version of the current date in the form of yyyy-mm-dd.
GeeksforGeeks
geeksforgeeks.org › javascript › how-to-get-current-formatted-date-dd-mm-yyyy-in-javascript
How to Get Current Formatted Date dd/mm/yyyy in JavaScript? - GeeksforGeeks
July 11, 2025 - '0' + month : month; return `${day}/${month}/${year}`; } const today = new Date(); console.log(getFormattedDate(today)); ... JavaScript is best known for web page development but it is also used in a variety of non-browser environments.
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date › now
Date.now() - JavaScript | MDN
// This example takes 2 seconds to run const start = Date.now(); console.log("starting timer..."); // Expected output: "starting timer..." setTimeout(() => { const ms = Date.now() - start; console.log(`seconds elapsed = ${Math.floor(ms / 1000)}`); // Expected output: "seconds elapsed = 2" }, 2000);
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date
Date - JavaScript | MDN
There are many ways to format a date as a string. The JavaScript specification only specifies one format to be universally supported: the date time string format, a simplification of the ISO 8601 calendar date extended format.
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date › Date
Date() constructor - JavaScript | MDN
The returned date's timestamp is the same as the number returned by Date.now(). value · An integer value representing the timestamp (the number of milliseconds since midnight at the beginning of January 1, 1970, UTC — a.k.a. the epoch). dateString · A string value representing a date, parsed and interpreted using the same algorithm implemented by Date.parse(). See date time string format for caveats on using different formats.
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.
W3Schools
w3schools.com › js › js_dates.asp
JavaScript Dates
February 4, 2026 - JavaScript stores dates as number of milliseconds since January 01, 1970. Zero time is January 01, 1970 00:00:00 UTC. One day (24 hours) is 86 400 000 milliseconds. Now the time is: milliseconds past January 01, 1970
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Intl › DateTimeFormat › DateTimeFormat
Intl.DateTimeFormat() constructor - JavaScript | MDN
January 21, 2026 - When formatting Temporal.PlainDateTime and Temporal.Instant, year, month, day, hour, minute, and second default to "numeric". Implementations are required to support displaying at least the following subsets of date-time components: