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 Overflow
🌐
Bobby Hadz
bobbyhadz.com › blog › javascript-format-date-yyyymmdd
Format a Date as YYYY-MM-DD using JavaScript | bobbyhadz
March 6, 2024 - Passing a locale of sv to the toLocaleDateString method returns a Date string formatted as YYYY-MM-DD. ... All we had to do to get the date formatted as YYYYMMDD was remove the hyphens.
🌐
Google
developers.google.com › google workspace › google sheets › date and number formats
Date and number formats | Google Sheets | Google for Developers
January 21, 2026 - This document describes how to define new date and number format patterns, which you can include in your API request · Date-time and number formats let you control how your data appears in a sheet. Google Sheets provides some common formats to choose from, but you can also define your own formats
Discussions

html - How to get current formatted date dd/mm/yyyy in Javascript and append it to an input - Stack Overflow
I would like to add a current date to a hidden HTML tag so that it can be sent to the server: How can I add a More on stackoverflow.com
🌐 stackoverflow.com
Format JavaScript date as yyyy-mm-dd - Stack Overflow
format(new Date('Sun May 11,2014'), 'yyyy-MM-dd') "2014-05-11 ... I like the additional flexibility that this solution gives over the other answers to this question. I haven't thoroughly tested this, but for the format I desired (i.e. "yyyy-MM-dd hh:mm:ss"), it works just as expected. 2015-03-20T02:37:19.633Z+00:00 ... here's a version which avoids the eval and comments better jsfiddle... More on stackoverflow.com
🌐 stackoverflow.com
Javascript date format dd/mm/yy NOT dd/mm/yyyy - do I need to import a library?
I am developing a software simulation which uses dates/ calendars extensively. (a booking system) Some javascript has already been used in this project, for... More on community.articulate.com
🌐 community.articulate.com
12
0
June 8, 2017
Weird JavaScript date problem: new Date('MM/dd/yyyy') !== new Date('yyyy-MM-dd')
It is consistent: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse . A huge mess, but consistent and specified. More on reddit.com
🌐 r/javascript
13
4
August 8, 2014
People also ask

How do I format a date in JavaScript?
To format a date in JavaScript, you can use methods like toDateString() or toLocaleDateString(). These allow you to display the date in different formats, such as "Thu May 01 2025".
🌐
wscubetech.com
wscubetech.com › resources › javascript › programs › date-format
How to Format a Date in JavaScript? (7 Programs)
How can I format a JavaScript date to a specific format?
To format a JavaScript date to a specific format, combine getDate(), getMonth(), and getFullYear() with string manipulation. You can format the date as "DD-MM-YYYY" or any custom style.
🌐
wscubetech.com
wscubetech.com › resources › javascript › programs › date-format
How to Format a Date in JavaScript? (7 Programs)
How do I use toISOString() to format a date in JavaScript?
You can use toISOString() on a date object to get a standard format like "YYYY-MM-DDTHH:mm:ss:sssZ". It’s useful when you want to format a date in JavaScript for use with APIs or backend systems.
🌐
wscubetech.com
wscubetech.com › resources › javascript › programs › date-format
How to Format a Date in JavaScript? (7 Programs)
🌐
MUI X
mui.com › x › react-date-pickers › date-picker
React Date Picker component - MUI X
You can show a helper text with the date format accepted: Helper text example · MM/DD/YYYY · Helper text example · MM/DD/YYYY · <DatePicker label="Helper text example" slotProps={{ textField: { helperText: 'MM/DD/YYYY', }, }} /> Press Enter to start editing ·
🌐
WsCube Tech
wscubetech.com › resources › javascript › programs › date-format
How to Format a Date in JavaScript? (7 Programs)
October 31, 2025 - Learn 7 easy JavaScript programs to format dates in different styles. Explore methods using toDateString(), toLocaleDateString(), toISOString() and more.
🌐
Javascripts
javascripts.com › format-dates-as-yyyy-mm-dd-in-javascript
How to Format Dates as yyyy-mm-dd in JavaScript
June 23, 2023 - We will utilize JavaScript’s Intl.DateTimeFormat object to format a date as ‘yyyy-mm-dd’. This object allows us to format dates according to locale, and by specifying the ‘year’, ‘month’, and ‘day’ options we can achieve the ...
🌐
Vishalgarg
vishalgarg.io › articles › how-to-format-a-date-in-javascript
How to Format a Date in JavaScript, Date Formatting in JS - Vishal Garg
April 4, 2025 - Intl.DateTimeFormat : The Intl.DateTimeFormat object is a built-in object in JavaScript that allows you to format dates and times according to the locale and options you specify. It provides a more flexible way to format dates compared to string concatenation. For example, to format a date as "DD/MM/YYYY" using Intl.DateTimeFormat, you can do the following:
Find elsewhere
🌐
Jsdiaries
jsdiaries.com › how format a date in javascript to yy-mm-dd
How format a date in JavaScript to YY-MM-DD | The JavaScript Diaries
Essentially, using JavaScript’s various native date methods, we can construct an array where each index has the correct date format to yy-mm-dd. Then we can utilize .join('-')to combine each element of the array into a string with each element ...
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date
Date - JavaScript | MDN
The format is as follows: ... YYYY is the year, with four digits (0000 to 9999), or as an expanded year of + or - followed by six digits. The sign is required for expanded years. -000000 is explicitly disallowed as a valid year. MM is the month, with two digits (01 to 12).
🌐
W3Schools
w3schools.com › js › js_date_formats.asp
W3Schools.com
Independent of input format, JavaScript ... standard for the representation of dates and times. The ISO 8601 syntax (YYYY-MM-DD) is also the preferred JavaScript date format:...
🌐
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 - Example: In this example, we will use the iso string method to format the JavaScript date as yyyy-mm-dd ... const formatDateISO = (date) => { return date.toLocaleDateString('en-CA'); }; const currentDate = new Date(); console.log(formatDate...
🌐
PrimeNG
primeng.org › datepicker
PrimeNG
We cannot provide a description for this page right now
🌐
DevQA
devqa.io › format-date-javascript
How to Format a Date in JavaScript
// Include Moment.js in your HTML file before using it const date = moment(); const formattedDate = date.format('YYYY-MM-DD'); console.log(formattedDate); // Output: 2023-07-10
🌐
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 - Specific Date Format: To display a date in a specific format, such as DD/MM/YYYY, you can use Intl.DateTimeFormat with the appropriate options.
🌐
Reddit
reddit.com › r/javascript › weird javascript date problem: new date('mm/dd/yyyy') !== new date('yyyy-mm-dd')
r/javascript on Reddit: Weird JavaScript date problem: new Date('MM/dd/yyyy') !== new Date('yyyy-MM-dd')
August 8, 2014 -

Some day, someone will invent a JavaScript compiler that handles dates in a consistent manner. Sadly, today is not that day. I'm having an issue where two identical dates that are parsed from differently formatted strings are producing two different results.

For example,

new Date('08/01/2014')

will result in a value of "Fri Aug 01 2014 00:00:00 GMT-0400 (Eastern Daylight Time)", as expected.

However,

new Date('2014-08-01')

gives "Thu Jul 31 2014 20:00:00 GMT-0400 (Eastern Daylight Time)". An offset of 4 hours. Basically, what happens is that using the MM/dd/yyyy format uses the local timezone and yyyy-MM-dd uses UTC.

Now the weirder part: appending midnight, "00:00:00", to the date value gives the expected result regardless of which of the two formats are used.

This happens in Chrome, Firefox, and IE. I have not tested Safari and Opera but, since they both use Webkit, I expect the same problem.

I can code around this easily enough but does anyone know the reasoning behind this?

🌐
Reddit
reddit.com › r/webdev › how get a date formatted like 2023-02-07 in js?
r/webdev on Reddit: How get a date formatted like 2023-02-07 in JS?
March 13, 2023 -

I'm going insane. I had this feature working perfectly. Took 2 weeks vacation. I come back and it's broken.

I know y'all will say this is impossible, but I was getting that format by using `date.toLocaleDateString('en-CA')`. I know the spec says that format is "dd/MM/yyyy", which isn't what I want, but I was giving me the format in the title, I swear to God.

This is such a stupid little thing but I've already spent hours on SO. It's just endless threads about people confused about datetimes and the differences between timezones and offsets and no one's talking about this silly little thing.

I have my new date: Wed Feb 08 2023 00:00:00 GMT-0500 (Eastern Standard Time)

I just need a simple operation to flip the string around so it becomes 2023-03-08

That is it. Please help

p.s. the date is always set to midnight user local time so offset can be ignored. Whatever day they're experiencing is the day to be formatted. Thank you