Javascript Program to Display Current Date & Time in Browser Full Project For Beginners

 

 

script.js

 

 

// program to display the date
// get local machine date time
const date = new Date();

// get the date as a string
const n = date.toDateString();

// get the time as a string
const time = date.toLocaleTimeString();

// display date
console.log('Date: ' + n);

// display time
console.log('Time: ' + time);

Leave a Reply