• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

How to create a container above the inbox with UTC time?

Jake Bunce

XenForo moderator
Staff member
#5
Example:

Admin CP -> Appearance -> Templates -> ad_header

Add this:

Code:
<div style="float: right;">
{xen:datetime $serverTime, 'absolute'}
</div>
 
#6
Thanks. Exactly what I was looking for. The positioning is spot on!

time.png


Is it possible to format the time/date string so the output is HH:SS with a string value of "UTC" to the right of the time?
 

Jake Bunce

XenForo moderator
Staff member
#7
Is it possible to format the time/date string so the output is HH:SS with a string value of "UTC" to the right of the time?
Code:
<div style="float: right;">
{xen:datetime $serverTime, 'absolute'} UTC
</div>
But as I said before, the time is not in UTC. It uses the timezone of the current logged in user. You will find that if you change your timezone the reported time will change.
 

Jake Bunce

XenForo moderator
Staff member
#9
Unfortunately I don't know of any template function or other method to output a specific time zone. The time zone is available in the visitor array, but only as a string (e.g. ["timezone"] => string(19) "America/Los_Angeles") which can't be used for an offset calculation.
 

Jake Bunce

XenForo moderator
Staff member
#11
Is it possible to use some other PHP time variables?
It's possible with a template hook listener. Here is a code example of a template hook:

http://xenforo.com/community/threads/how-to-create-a-bridge.28515/#post-331631

For your purposes you can use the "ad_header" hook which will insert your content in the ad_header template.

Then you need to write the code to build the current time string in UTC and append it to the $contents of the hook.

If you are not a programmer then you can post a request:

http://xenforo.com/community/forums/custom-service-development-requests.69/