Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JavaScript Automatic Objects to Primitive Data Types Conversions</title> </head> <body> <script> let date1 = new Date(2018, 5, 24); document.write(date1 + "<br>"); // Display date string like: Sun Jun 24 2018 00:00:00 let date2 = new Date(2025, 8, 15); let time = date2 - date1; document.write(time) // Display time in milliseconds: 228096000000 </script> </body> </html>