W3Schools
w3schools.com โบ jsref โบ jsref_now.asp
JavaScript Date now() Method
Date.now() returns the number of milliseconds since January 1, 1970.
W3Schools
w3schools.com โบ js โบ js_dates.asp
JavaScript Dates
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
Videos
๐ฅ How to Format Dates in JavaScript 2023 - YouTube
11:59
The Easiest Way to Format Dates in JavaScript - YouTube
16:02
Format Your Own Dates With JavaScript - YouTube
01:00
How To Easily Format Dates In JavaScript - YouTube
05:02
How to Get Current Date & Time in JavaScript | Date Object Tutorial ...
W3Schools
w3schools.com โบ js โบ js_date_formats.asp
JavaScript Date Formats
The ISO 8601 syntax (YYYY-MM-DD) is also the preferred JavaScript date format:
W3Schools
w3schools.com โบ js โบ js_date_methods.asp
JavaScript Date Methods
Date.now() returns the number of milliseconds since January 1, 1970.
W3Schools
w3schoolsua.github.io โบ js โบ js_dates_en.html
JavaScript Date Objects. Lessons for beginners. W3Schools in English
JavaScript stores dates as number of milliseconds since January 01, 1970, 00:00:00 UTC (Universal Time Coordinated). Zero time is January 01, 1970 00:00:00 UTC. Now the time is: milliseconds past January 01, 1970
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:

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.
W3Schools
w3schools.com โบ js โบ js_date_reference.asp
JavaScript Date Reference
JS Dates JS Date Formats JS Date Get JS Date Set JS Date Methods JS Temporal New ยท Temporal Study Path Temporal Intro Temporal vs Date Temporal Now Temporal Instant Temporal PlainDate Temporal PlainTime Temporal PlainDateTime Temporal ZonedDateTime Temporal Duration Temporal Arithmetic Temporal Migrate Temporal Reference JS Arrays
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(). ... 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). ... 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.
W3Schools
w3schools.com โบ jsref โบ jsref_date_new.asp
JavaScript new Date Method
The new Date() constructor creates a new Date object. ... If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail: sales@w3schools.com ยท If you want to report an error, or if you want to make ...
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);
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:
GeeksforGeeks
geeksforgeeks.org โบ javascript โบ javascript-date-now-method
JavaScript Date now() Method - GeeksforGeeks
July 11, 2025 - 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. We have a complete list of Javascript Date Objects, to check those please go through this
Codecademy
codecademy.com โบ article โบ javascript-date-format
How to Format a Date in JavaScript | Codecademy
By understanding these techniques, we can efficiently customize the format of a date according to our preferences. In this tutorial, we explored how to get dates in JavaScript, format them using different inbuilt methods, and covered the techniques that you can use for customized date formatting in JavaScript.
W3Schools Blog
w3schools.blog โบ home โบ javascript date tutorial
JavaScript Date Tutorial - W3schools
April 21, 2019 - toISOString() method: Use: To get the date in the form ISO format string.
W3Schools
w3schools.com โบ js โบ js_date_methods_set.asp
JavaScript Date Set Methods
JS Dates JS Date Formats JS Date Get JS Date Set JS Date Methods JS Temporal New ยท Temporal Study Path Temporal Intro Temporal vs Date Temporal Duration Temporal Now Temporal Instant Temporal PlainDate Temporal PlainTime Temporal PlainDateTime Temporal ZonedDateTime Temporal Arithmetic Temporal Migrate Temporal Reference JS Arrays
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