note 52227 deleted from function.time by aidan
| From: | aidan@php.net | Date: | Sat, 08 Oct 2005 01:03:21 +0000 |
| Subject: | note 52227 deleted from function.time by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-96604@lists.php.net to get a copy of this message | ||
Note Submitter: alex
----
sorry, quick correction on previous post
JavaScript's getTime() actually uses GMT, you must incorporate the getTimezoneOffset() in order
to make it any different then PHP's time().
like so:
<script language="JavaScript">
function addTime() {
var d = new Date();
var TI = document.getElementById('time');
TI.value=Math.floor(d.getTime()/1000)-(d.getTimezoneOffset()*60);
}
</script>
simply set that function as the onsubmit of any form the has a hidden <input> with
id="time" any you're golden. getTimezoneOffset gives the offset difference in
minutes, hence the *60. I hope this is of assistance to someone.