find the current date in javascript

To find the current date in Javascript, you can use the Date() object. Here's an example code snippet:

index.tsx
const today = new Date();
const currentDate = today.getTime();
console.log(currentDate);
89 chars
4 lines

This will create a new Date object with the current date and time. Then, we can use the getTime() method to get the current timestamp in milliseconds.

Alternatively, you can also use the toUTCString() method to get the current date in a readable format:

index.tsx
const today = new Date();
const currentDate = today.toUTCString();
console.log(currentDate);
93 chars
4 lines

This will return something like "Tue, 05 Oct 2021 08:30:00 GMT".

gistlibby LogSnag