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 OverflowMDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date
Date - JavaScript | MDN
JavaScript Date objects represent a single moment in time in a platform-independent format. Date objects encapsulate an integral number that represents milliseconds since the midnight at the beginning of January 1, 1970, UTC (the epoch).
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
11:59
The Easiest Way to Format Dates in JavaScript - YouTube
16:02
Format Your Own Dates With JavaScript - YouTube
10:51
How to Format Dates with Vanilla JavaScript - YouTube
05:02
How to Get Current Date & Time in JavaScript | Date Object Tutorial ...
07:37
How to Format Dates and Times in Make.com - YouTube
06:14
#22 - Show and format the current date - YouTube
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);
Moment.js
momentjs.com › docs
Moment.js | Docs
Get + Set Millisecond Second Minute Hour Date of Month Day of Week Day of Week (Locale Aware) ISO Day of Week Day of Year Week of Year Week of Year (ISO) Month Quarter Year Week Year Week Year (ISO) Weeks In Year Weeks In Year (ISO) Get Set Maximum Minimum · Manipulate Add Subtract Start of Time End of Time Maximum Minimum Local UTC UTC offset Time zone Offset · Display Format Time from now ...
W3Schools
w3schools.com › jsref › jsref_now.asp
JavaScript Date now() Method
The syntax is always Date.now().
IBM
ibm.com › docs › en › cobol-zos › 6.3.0
FORMATTED-CURRENT-DATE
The FORMATTED-CURRENT-DATE function returns a character string that represents the current date and time provided by the system on which the function is evaluated. The content of the returned value is formatted according to the format in the argument.
Excel Forum
excelforum.com › excel-formulas-and-functions › 537287-easy-format-now-as-mm-dd-yyyy.html
EASY: Format NOW as mm/dd/yyyy
> > Something like =formatdate(now();mm/dd/yyyy) > > Thanks! ... That worked out! Thanks a lot!!! ... There are currently 1 users browsing this thread. (0 members and 1 guests) ... All times are GMT -4. The time now is 09:23 AM.
Make
help.make.com › date-and-time-functions
Date and time functions - Help Center
but its last millisecond 2019 09 01t00 00 00 000z ≤ d ≤ 2019 09 30t23 59 59 999z {{parsedate(parsedate(formatdate(now; "yyyymm01"); "yyyymmdd"; "utc") 1; "x")}} if the result should respect your timezone settings, simply omit the utc argument {{parsedate(parsedate(formatdate(now; "yyyymm01"); "yyyymmdd") 1; "x")}} however, it is preferable to use a half open interval instead (the interval that excludes one of its limit points), specifying the first day of the following month instead and replacing the less or equal than operator with less than 2019 09 01 ≤ d < 2019 10 01 2019 09 01t00 00
Day.js
day.js.org › docs › en › display › format
Format · Day.js
dayjs().format() // current date in ISO8601, without fraction seconds e.g.
MySQL
dev.mysql.com › doc › en › date-and-time-functions.html
MySQL :: MySQL 8.4 Reference Manual :: 14.7 Date and Time Functions
Returns the current date and time as a value in 'YYYY-MM-DD hh:mm:ss' or YYYYMMDDhhmmss format, depending on whether the function is used in string or numeric context. The value is expressed in the session time zone. If the fsp argument is given to specify a fractional seconds precision from ...
Educative
educative.io › answers › what-is-datenow-in-javascript
What is Date.now() in Javascript?
In Javascript, the .now() method is a Date static method that returns the number of milliseconds since January 1, 1970 00:00:00 UTC.
Top answer 1 of 16
1660
Just leverage the built-in toISOString method that brings your date to the ISO 8601 format:
let yourDate = new Date()
yourDate.toISOString().split('T')[0]
Where yourDate is your date object.
Edit: @exbuddha wrote this to handle time zone in the comments:
const offset = yourDate.getTimezoneOffset()
yourDate = new Date(yourDate.getTime() - (offset*60*1000))
return yourDate.toISOString().split('T')[0]
2 of 16
998
You can do:
function formatDate(date) {
var d = new Date(date),
month = '' + (d.getMonth() + 1),
day = '' + d.getDate(),
year = d.getFullYear();
if (month.length < 2)
month = '0' + month;
if (day.length < 2)
day = '0' + day;
return [year, month, day].join('-');
}
console.log(formatDate('Sun May 11,2014'));
Usage example:
console.log(formatDate('Sun May 11,2014'));
Output:
2014-05-11
Demo on JSFiddle: http://jsfiddle.net/abdulrauf6182012/2Frm3/