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

XF 1.0 Relative Timestamps


XenForo Developer
Staff member
In the beginning, dates next to content on the internet were ugly things. We used to see date/time strings like 07-29-2010 16:31 and that would be it.

Then, options were added to allow administrators to specify a date/time format, and you could see output such as 4:31pm, Thursday June 29th 2010.

Later still, it was possible to output times relative to the present, so one could see dates like 3 minutes ago or Yesterday at 6:15pm.

However, these relative dates can be nasty when it comes to anything that is going to cache the page output. If a search engine slurps up the page, its cache is going to forever be wrong, as it will be locked at 3 minutes ago even when the content is weeks old. This can also be a problem for long threads. By the time you reach the bottom of a long page, the posts at the bottom could be several minutes older than when they were loaded into your browser, so their 2 minutes ago output is completely wrong.

XenForo addresses this by always outputting absolute dates and times, but our Javascript then identifies these instances and converts them into relative dates for the viewing user.

The icing on the cake is that all date/time instances automatically update as time goes by. If reply to a thread, your message will be posted and its date and time will be noted as 'A moment ago'. Wait a little while, and it will automatically update to read '1 minute ago' and will continue until it no longer makes sense to display a relative date.

I have yet to grow tired of seeing all the dates in a thread simultaneously update all by themselves :)


Well-known member
I actually like this method. I didn't think this was possible, hence I stuck to the exemplar in my custom CMS. I'll certainly look into this.


Well-known member
Very nice functionality. So, if I load a page with JS disabled (and this is what crawlers see), I'm going to see the actual date the post was made?