how to get local time in javascript code example

how to get local time in javascript

1

1 Example

0
// Creating a Date object
const dateObj = new Date();
  
// Printing the date and time parts
console.log(`Date: ${dateObj.toDateString()}`);
console.log(`Time: ${dateObj.toTimeString()}`);
by on

Other Code Examples