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
🌐
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.
🌐
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" }, ...
🌐
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.
🌐
JavaScript.info
javascript.info › tutorial › the javascript language › data types
Date and time
Dates can be subtracted, giving their difference in milliseconds. That’s because a Date becomes the timestamp when converted to a number. Use Date.now() to get the current timestamp fast.
🌐
freeCodeCamp
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 - Dealing with date and timestamp formatting can be exhausting. In this guide, you will learn how to get the current date in various formats in JavaScript.
🌐
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.
🌐
Moment.js
momentjs.com › docs
Moment.js | Docs
Display Format Time from now Time from X Time to now Time to X Calendar Time Difference Unix Timestamp (milliseconds) Unix Timestamp (seconds) Days in Month As Javascript Date As Array As JSON As ISO 8601 String As Object As String Inspect
Find elsewhere
🌐
W3Resource
w3resource.com › javascript-exercises › javascript-basic-exercise-3.php
JavaScript: Display the current date in various format - w3resource
// Get the current date var today ... (mm < 10) { mm = '0' + mm; } // Format the date as mm-dd-yyyy and log it today = mm + '-' + dd + '-' + yyyy; console.log(today); // Format the date as mm/dd/yyyy and log it today = mm + '/' ...
🌐
W3Schools
w3schools.com › jsref › jsref_now.asp
JavaScript Date now() Method
Date.now() is an ECMAScript5 (ES5 2009) feature. JavaScript 2009 is supported in all browsers since July 2013:
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › javascript-date-now-method
JavaScript Date now() Method - GeeksforGeeks
July 11, 2025 - The Date.now() method in JavaScript returns the current timestamp in milliseconds since January 1, 1970.
🌐
GitHub
gist.github.com › Ivlyth › c4921735812dd2c0217a
format javascript date to format "YYYY-mm-dd HH:MM:SS" · GitHub
function NOW() { var date = new Date(); var aaaa = date.getUTCFullYear(); var gg = date.getUTCDate(); var mm = (date.getUTCMonth() + 1); if (gg < 10) gg = "0" + gg; if (mm < 10) mm = "0" + mm; var cur_day = aaaa + "-" + mm + "-" + gg; var hours ...
🌐
LogRocket
blog.logrocket.com › home › how to format dates in javascript: methods, libraries, and best practices
How to format dates in JavaScript: Methods, libraries, and best practices - LogRocket Blog
May 8, 2025 - Here’s what you need to know: // Creating a new Date object const now = new Date(); // Current date and time const isoDate = new Date('2025-02-18T14:30:00.000Z'); // From date string const withComponents = new Date(2025, 1, 18); // Year, month ...
🌐
W3Schools
w3schools.com › js › js_date_formats.asp
JavaScript Date Formats
ISO 8601 is the international standard for the representation of dates and times. The ISO 8601 syntax (YYYY-MM-DD) is also the preferred JavaScript date format:
🌐
W3Schools
w3schools.com › js › js_dates.asp
JavaScript Dates
Specifying a day higher than max, will not result in an error but add the overflow to the next month: ... You cannot omit month. If you supply only one parameter it will be treated as milliseconds. ... 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
Top answer
1 of 16
277

You may want to try

var d = new Date();
d.toLocaleString();       // -> "2/1/2013 7:37:08 AM"
d.toLocaleDateString();   // -> "2/1/2013"
d.toLocaleTimeString();  // -> "7:38:05 AM"

Documentation

2 of 16
219

A JavaScript Date has several methods allowing you to extract its parts:

getFullYear() - Returns the 4-digit year
getMonth() - Returns a zero-based integer (0-11) representing the month of the year.
getDate() - Returns the day of the month (1-31).
getDay() - Returns the day of the week (0-6). 0 is Sunday, 6 is Saturday.
getHours() - Returns the hour of the day (0-23).
getMinutes() - Returns the minute (0-59).
getSeconds() - Returns the second (0-59).
getMilliseconds() - Returns the milliseconds (0-999).
getTimezoneOffset() - Returns the number of minutes between the machine local time and UTC.

There are no built-in methods allowing you to get localized strings like "Friday", "February", or "PM". You have to code that yourself. To get the string you want, you at least need to store string representations of days and months:

var months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
var days = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];

Then, put it together using the methods above:

var months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
var days = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
var d = new Date();
var day = days[d.getDay()];
var hr = d.getHours();
var min = d.getMinutes();
if (min < 10) {
    min = "0" + min;
}
var ampm = "am";
if( hr > 12 ) {
    hr -= 12;
    ampm = "pm";
}
var date = d.getDate();
var month = months[d.getMonth()];
var year = d.getFullYear();
var x = document.getElementById("time");
x.innerHTML = day + " " + hr + ":" + min + ampm + " " + date + " " + month + " " + year;
<span id="time"></span>

I have a date format function I like to include in my standard library. It takes a format string parameter that defines the desired output. The format strings are loosely based on .Net custom Date and Time format strings. For the format you specified the following format string would work: "dddd h:mmtt d MMM yyyy".

var d = new Date();
var x = document.getElementById("time");
x.innerHTML = formatDate(d, "dddd h:mmtt d MMM yyyy");

Demo: jsfiddle.net/BNkkB/1

Here is my full date formatting function:

const MMMM = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
const MMM = MMMM.map(m => m.slice(0, 3));
const dddd = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
const ddd = dddd.map(d => d.slice(0, 3));

function ii(i, len = 2) {
    return (i + "").padStart(len, "0");
}

function tzHHMM(tz) {
    const sign = tz > 0 ? "-" : "+"; // +08:00 == -480, signs are reversed
    const tzv = Math.abs(tz);
    const tzHrs = Math.floor(tzv / 60);
    const tzMin = tzv % 60;
    return sign + ii(tzHrs) + ":" + ii(tzMin);
}

function formatDate(date, format, utc) {
    const y = utc ? date.getUTCFullYear() : date.getFullYear();
    const M = utc ? date.getUTCMonth() : date.getMonth();
    const d = utc ? date.getUTCDate() : date.getDate();
    const H = utc ? date.getUTCHours() : date.getHours();
    const h = H > 12 ? H - 12 : H == 0 ? 12 : H;
    const m = utc ? date.getUTCMinutes() : date.getMinutes();
    const s = utc ? date.getUTCSeconds() : date.getSeconds();
    const f = utc ? date.getUTCMilliseconds() : date.getMilliseconds();
    const TT = H < 12 ? "AM" : "PM";
    const tt = TT.toLowerCase();
    const day = utc ? date.getUTCDay() : date.getDay();
    const replacements = {
        y,
        yy: y.toString().slice(-2),
        yyy: y,
        yyyy: y,
        M,
        MM: ii(M),
        MMM: MMM[M],
        MMMM: MMMM[M],
        d,
        dd: ii(d),
        ddd: ddd[day],
        dddd: dddd[day],
        H,
        HH: ii(H),
        h,
        hh: ii(h),
        m,
        mm: ii(m),
        s,
        ss: ii(s),
        f: Math.round(f / 100),
        ff: ii(Math.round(f / 10)),
        fff: ii(f, 3),
        ffff: ii(f * 10, 4),
        T: TT[0],
        TT,
        t: tt[0],
        tt,
        K: utc ? "Z" : tzHHMM(date.getTimezoneOffset()),
        "\\": "",
    };
    return format.replace(/(?:\\(?=.)|(?<!\\)(?:([yMdf])\1{0,3}|([HhmsTt])\2?|K))/g, $0 => replacements[$0]);
}
🌐
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.
🌐
Sentry
sentry.io › sentry answers › javascript › how do i get the current date in javascript?
How do I get the Current Date in JavaScript? | Sentry
Create a timestamp using the Date.now() method. This represents the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC (ECMAScript epoch), with leap seconds ignored: ... For example, you can create and save the timestamp when a ...
🌐
Stevenlevithan
blog.stevenlevithan.com › archives › javascript-date-format
JavaScript Date Format
Before getting into further details, here are some examples of how this script can be used: var now = new Date(); now.format("m/dd/yy"); // Returns, e.g., 6/09/07 // Can also be used as a standalone function dateFormat(now, "dddd, mmmm dS, yyyy, h:MM:ss TT"); // Saturday, June 9th, 2007, 5:46:21 ...
🌐
ReqBin
reqbin.com › code › javascript › vykp4kwe › javascript-date-format-example
How to Format Date in JavaScript?
The month and day can be in any of the first positions - "MMM DD YYYY" or "DD MMM YYYY" - so both of these formats are valid. You can write full month names or abbreviate them in long dates.