document.write(new Date().getFullYear());
let today = new Date().toLocaleDateString();
//or function
function getDate()
{
let today = new Date();
let dd = String(today.getDate()).padStart(2, '0');
let mm = String(today.getMonth() + 1).padStart(2, '0'); //janvier = 0
let yyyy = today.getFullYear();
return `${yyyy}-${mm}-${dd}`;
//return dd + '/' + mm + '/' + yyyy; // change form if you need
}
function getTodayDate() {
let d = new Date();
return d;
}
console.log(getTodayDate());
//2020-12-06T09:53:14.105Z
let date = new Date(); //actual time in miliseconds
let string = date.toString();
// expected output: Wed Jul 28 1993 14:39:07 GMT+0200 (CEST)
// if you need more power: date-fns.js or moment.js
(new File([new Blob([''])],'')).lastModified
// returns a date seed example
let seed=1663094715115;
let date=new Date(seed) //'2022-09-13T18:46:40.108Z'