How should I save the pc’s time (not server time) in a PHP variable?
I tried
$a='<script type="text/javascript"> document.write(Date()) </script>';
without luck
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The only way to do that would be to send it to the PHP script via a form or query. All the PHP is executed on the server and sent out to whoever requested it. The PC time would have to be sent back to the server for it to know what it is.
Edit: If you want to just use javascript to show the current PC time you can echo out this in your code:
In PHP it would be:
It would show up as Thu Jul 26 2012 00:17:43 GMT+1000 (EST) on the client PC. Here is a link to a decent tutorial on how to use javascript to display dates, times and all sorts of other goodies based on the users PC.
Edit 2: This Javascript will display the date and time nicely.