Re: getting the 'client' date and time for use in PHP scripts ??
| From: | Tom Rogers | Date: | Tue, 09 Apr 2002 02:24:36 +0000 |
| Subject: | Re: getting the 'client' date and time for use in PHP scripts ?? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-92157@lists.php.net to get a copy of this message | ||
Hi
Here is the answer I gave a few days ago to the same sort of question:
<head>
<title>Untitled</title>
<?if(!isset($Submit)):?>
<script language="JavaScript">
<!-- begin
function gogo() {
var dt = new Date();
var mm,dd,yy,h,m,s;
mm = dt.getMonth()+1;
dd = dt.getDate();
yy = dt.getYear();
h = dt.getHours();
m = dt.getMinutes();
s = dt.getSeconds();
document.location="<?echo $PHP_SELF?>?Time="+h+":"+m+":"+s+"&Submit=yes&Month="+mm+"&Day="+dd+"&Year="+yy
}
// end -->
</script>
<?endif?>
</head>
<body<?if(!isset($Submit)):?> onload="gogo()"<?endif?>>
<?
if(isset($Submit)):
echo "Remote date = $Month/$Day/$Year $Time <br>";
endif;
?>
</body>
At 05:20 AM 9/04/2002, David Eisenhart wrote:
Hi Does anyone know of a technique for obtaining the date and time of the client's system? (I can conceive of generating this with Java Script and passing it to pages within the site, but it is important that this information is obtained by the 'first' page that the user accesses.) Any ideas gratefully received. David -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php