...

Web Technologies - JAVASCRIPT

Back to Course

Lesson Description


Lession - #222 Javascript Dates


A JavaScript date is generally determined as the number of milliseconds that have elapsed by since 12 midnight on January 1, 1970, UTC.

What does JavaScript Date (>
function do?

Date methods permit you to get and set the year, month, day, hour, minute, second, and millisecond of date objects, utilizing either local time or UTC (universal, or GMT>
time.

Let's see an javascript example



<!DOCTYPE html>
<html>
<body>

<h2>JavaScript new Date(>
</h2> <p>Using new Date(>
, creates a new date object with the javascript get current date and time:</p> <p id="demo"></p> <script> const d = new Date(>
; document.getElementById("demo">
.innerHTML = d; </script> </body> </html>

Output


Try it here