0

Best result i get is this, its simplest code i found here and save to MySQL on correct format. but i need to get GMT+7 datetime, how to add additional 7 Hours to this script?

          <html>
          <head>
          <title>Web Page Design</title>
          <script>
          document.writeln(new Date().toISOString().slice(0, 19).replace('T', ' '));
          </script>
          </head>
          <body><br>Current Date is displayed above...</body></html>`

Result :

2018-11-23 11:14:38 
Current Date is displayed above...
Gnometa
  • 35
  • 9
  • Does this solve your problem? [Adding hours to JavaScript Date object?](https://stackoverflow.com/questions/1050720/adding-hours-to-javascript-date-object) – Itay Daniel Zecharia Apr 30 '20 at 08:10

1 Answers1

0

If you just need to add 7 hours here is an example:

  <html>

    <head>
      <title>Web Page Design</title>
      <script>
        var now = new Date();
        now.setHours(now.getHours() + 7);
        document.writeln(now.toISOString().slice(0, 19).replace('T', ' '));

      </script>
    </head>

    <body><br>Current Date is displayed above...</body>

  </html>`
user1987
  • 231
  • 1
  • 6