My First JavaScript
bg My First JavaScript Click me to display Date and Time. Using a Full URL File Path HTML Emoji Example 🗽 // Creating object of // Date constructor const currentDate = new Date(); // Extract components of the date and time // Getting year: 2023 const year = currentDate.getFullYear(); // Getting month const month = currentDate.getMonth() + 1; // Getting day const day = currentDate.getDate(); // Getting hours const hours = currentDate.getHours(); // Getting minutes const minutes = currentDate.getMinutes(); // Getting seconds const seconds = currentDate.getSeconds(); // Using template literal for // printing the date and time // in console console.log(`Current Date: ${year}-${month}-${day}`); console.log(`Current Time: ${hours}:${minutes}:${seconds}`); HTML Emoji Example 🗼