![]() |
Help Adding Server Time to Footer
I'm trying to put the server time into the footer, so it would read something like this:
All times are GMT +8. The time now is 08:15 AM. | Server Time: 00:15 AM. I found an article on how to do it for vb3.8 but it doesn't want to work. The article can be found here. Thanks in advance. |
Try using this for the plugin code:
Code:
$server_time = date('h:i:s A'); and then in the template: HTML Code:
<br />The server time is now {vb:raw server_time}. |
Thanks kh99 - I'm at least now getting a result, albeit an incorrect one, or unexpected one.
Code in html is: HTML Code:
<div class="below_body"> All times are GMT +8. The time now is 09:18 AM. | Server Time: 08:18 PM Server time should be 02:18 AM Perhaps the server is running on a different timezone to GMT? Maybe I need to implement the timezone into the code you gave above? |
Yeah, I'm not sure, I just copied the code from that thread you linked to. Reading the docs for date() it seems like your server is probably not set to GMT. I suppose you could just add 6 hours worth of seconds to it, something like date('h:i:s A', time() + 6 * 3600);
|
Beautiful! That'll do the trick just nicely. Thanks for your help :)
|
You're welcome. But apparently I misunderstood the docs - you should be able to use gmdate() instead of date() to get GMT.
|
Oh even better. Thanks again! :)
|
All times are GMT. The time now is 04:02 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|