I am trying to get date data from a php script to the html where it displays the current time of when the page was loaded initially. And the current time updated in real-time.
I have been able to get the current time using the
date_default_timezone_set('Europe/London');
echo date('m/d/Y h:i:s a', time()); ...
But I cant find what the function is to get the time that the webpage was opened?
Any help please. Okay I made a mistake and got it switched. I have the time of page load and now I need the current time in real-time retrieved.
No worries guys, thanks for helping me on the first bit I am gonna go try and get the real-time thingy myself :)
date('m/d/Y h:i:s a', time())
will be the time you generated the page.
For updating it real-time, you will need to use some client side code, as PHP
only runs on the server-side.
For the real-time clock, I would suggest you to look at the JQuery
library for JavaScript
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.