| Home => PHP Projects => Dates/Times |
Using very little PHP, this project will produce the following output at the bottom of a web page
|
The time on your computer is: hh:mm:ss AM The time on the web server is: hh:mm:ss PM Prior to you, the last person to look at this web page did so at: hh:mm:ss PM |
The first line is produced on your computer, the last two lines are produced on the web server machine by PHP. The heart of the issue is producing the last line, a record of the last time each web page was viewed.
The first line comes from client side JavaScript that looks like this:
|
<script language="JavaScript"> tempdate = new Date(); document.write("The time on your comptuer is: " + tempdate.toLocaleString() +"<br>"); </script> |
Here is the output the above script produced for you, now:
PHP has a date function that can be used to externalize the date on the web server computer. For example, this PHP code:
The PHP date function, output right now is:
The time on the server is: Thursday, May 15, 2008 8:18:55 AM
| Viewed 19064 times since July 17,2007 (63 per day over 303.1 days) | Home => PHP Projects |
| Page: www.michaelhorowitz.com | Last Updated: May 24, 2005 5 PM |
| Prior to you, the last person to look at this web page did so on | Thursday, May 15, 2008 7:25:37 AM |
| Current time on the server is | Thursday, May 15, 2008 8:18:55 AM |
| 38.103.63.17 | no name found |
| 66.249.65.71 | crawl-66-249-65-71.googlebot.com |
| 59.96.24.52 | no name found |
| 61.246.177.137 | egress-del1.globallogic.com |
| 67.195.37.107 | llf320021.crawl.yahoo.net |
