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...
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>`
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.