javascript getdate 1

javascript getdate

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

Here is what the above code is Doing:
1. We create a new Date object.
2. We call the toString() method on the Date object.
3. We assign the result to a variable.

The result is a string that represents the current date and time.

Similar Posts