[2024-10-12] Get user local time using Javascript
This commit is contained in:
parent
7356b00de1
commit
13ec41e8a4
2 changed files with 33 additions and 7 deletions
18
templates/init.html
Normal file
18
templates/init.html
Normal file
|
@ -0,0 +1,18 @@
|
|||
<html>
|
||||
<div style="visibility: hidden">
|
||||
<form id="form" method="POST" action="/">
|
||||
<input name="timestamp" id="timestamp" type="number"></input>
|
||||
</form>
|
||||
</div>
|
||||
</html>
|
||||
<script>
|
||||
window.onload = function(e){
|
||||
var d = new Date();
|
||||
var timestamp = Math.round(d.getTime() / 1000);
|
||||
input = document.getElementById("timestamp")
|
||||
input.value = timestamp;
|
||||
form = document.getElementById("form")
|
||||
form.submit();
|
||||
console.log(time);
|
||||
}
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue