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

XF 1.5 Date Format

Amaury

Well-known member
#1
I feel like I've asked this before, but I'm not sure.

One thing I liked about vBulletin is that you could have one date format for posts and another for the general forum. (In our case, it was the same before we moved.) I was just wondering if this were possible with template edits on XenForo (maybe even more flexible than on vBulletin) or if it'd require an add-on to be done properly?

Thank you.
 

Jake Bunce

XenForo moderator
Staff member
#2
In the templates you can use this:

Code:
{xen:date $serverTime, 'j -F Y h:i:s'}
The quoted string is the format which uses the vars from this page:

PHP: date - Manual

So you can edit a specific template and insert this code in place of the existing date code. Just be sure to pass it the available timestamp variable ($serverTime is just the current time).

The problem with this template code is that you lose the relative times (e.g. "a moment ago"). This post explores the code a bit more if you are interested:

XF 1.1 - How to change the post date format?