screen_rotation
Copied to Clipboard
<!DOCTYPE html> <html lang="en"> <head> <script> function checkDate() { var dateString = "2/21/2023"; // Date format MM/DD/YYYY var dateToCheck = new Date(dateString); var currentDate = new Date(); var resultElement = document.getElementById('result'); if (dateToCheck < currentDate) { resultElement.textContent = 'The date is in the past.'; } else { resultElement.textContent = 'The date is not in the past.'; } } </script> </head> <body> <h2>Javascript Check if Date is in the Past</h2> <p>Date : 21-2-2023</p> <button onclick="checkDate()">Check Date</button> <p id="result"></p> </body> </html>