Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JavaScript Convert UTC Date Time to Local Date Time</title> </head> <body> <script> // Create date object from datetime string var date = new Date('Tue, 21 Apr 2020 09:20:30 GMT'); // Coverting to local datetime document.write(date.toString() + "<br>"); // Coverting local datetime back to UTC document.write(date.toUTCString()); // Tue, 21 Apr 2020 09:20:30 GMT </script> </body> </html>