paulmo Posted April 4, 2008 Share Posted April 4, 2008 along with php script on separate page, here's some js (on html form page) to try to get local time from user form (only gettting server time now). could someone please help me with this? thanks <script type="text/javascript">function main(){ var hours = (new Date()).getHours(); var offset = document.getElementById('offset'); offset.value = hours - offset.value;}</script></head><body onload="main();"> Link to comment Share on other sites More sharing options...
justsomeguy Posted April 4, 2008 Share Posted April 4, 2008 What is offset? Link to comment Share on other sites More sharing options...
aspnetguy Posted April 11, 2008 Share Posted April 11, 2008 Why not do this function main(){ var date = new Date(); var time = date.getHours + ":" + date.getMinutes; var offset = document.getElementById('offset'); offset.value = time;} Now you have the exact time on the client machine (24 hour clock). Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.