...

Web Technologies - JAVASCRIPT

Back to Course

Lesson Description


Lession - #223 Javascript Dates Format


What format is date Now JavaScript?

const today = new Date(>
;
work formatDate(date, design>
{//} formatDate(today, 'mm/dd/yy'>
;

You need to replace the strings "mm", "dd", "yy" with the respective month, day and year values from the format string passed in the argument.

Let's see an example for javascript date format



<!DOCTYPE html>
<html>
<body>

<h2>JavaScript ISO Dates</h2>

<p id="demo"></p>

<script>
const d = new Date("2018-01-28">
; document.getElementById("demo">
.innerHTML = d; </script> </body> </html>

Output


Try it here