Should you show your age?

Show Your Age or Not? Image

Is a date on a blog post, a guide, or an article helpful or even required? Or does it just make your content look old, fast? And if you show dates, should you add an “updated” date together with the publish date?

It is a question one should think about carefully. Most of us post the date something was published on our sites by default. But if you are writing guides or articles that will be just as helpful in a year or two, will a date do more harm than good? Or can it even decrease the trust readers will have in your content?

I know that I look at dates when googling something technical, like configuring a Linux server. And I put more trust in a solution published this year or last than in one four years old. Even if the older post was just as good or even better, it is just human nature to think that newer equals better.

That is especially true for technical content simply because technology moves so incredibly fast. On the other hand, when checking how to make a Rum Runner, the date that recipe was published matters very little.

So perhaps dates have more of a place with tech content than with other subjects?

We will explore these issues below and then show you how to add and format dates in ExpressionEngine.

Table of Contents

Dating your content - should you?

Should you date your web content? Well, if your content likes you back, of course you should! OK, that was an attempt at a joke … I will stop that now :)

But as with most questions, it depends:

  • If you are writing technical content, a publish date may be helpful. But can also make your content appear dated. A good idea is to always use an updated date together with your publish date to show you revisit and update your content regularly.

    A great example of this are the guides at, some of which were been published years ago. But they are constantly updated to reflect changes in the technology or underlying platform.

  • If you are a blogger, dates are a way of establishing chronology. But if you don’t publish very often, your existing content can quickly look dated and stale. Which it is, I suppose, so fair enough. But consider leaving the date out or showing a relative date. You can still sort your entries by date without showing it.

  • If you run a news site, showing the publish and updated dates are pretty much a given.

  • Here at Greycells, we use relative publish dates on the front page, and both publish and updated dates on article pages like this one. All of which you can learn more about below.

  • And then, of course, there are the cheaters. A trend has emerged lately, where some sites automatically update the publish dates without actually updating the content. This makes everything look fresh all the time when googled. But when readers find out you do this, it totally destroys credibility. I understand the urge, but it is pretty much a sign of desperation — do not do it.

Dating content in ExpressionEngine

Let’s see how we can use ExpressionEngine’s {entry_date} and {edit_date} tags, to show when our entries were posted and updated.

Dates on the front page

On the front page of, we are using relative dates. If an entry is three days old or less, we show the date as either X hours ago or X days ago, and if it is older, we show the full date.

The code for this is:

<section class="info">
   <p>By {author} &rarr; {entry_date:relative units="days|hours" stop="+3 day" format="%F %j, %Y" about=""}</p>

Let us run through the code.

Note: This all takes place within the Channel Entries tag that creates the front page content. It has to, or ExpressionEngine would not know from which entry it should pull the author and dates.

  1. First, we have a div so we can format this section with CSS independently.
  2. We then pull the author of the article using ExpressionEngine’s {author} tag.
  3. Then we show a right-pointing arrow with &rarr;.
  4. And finally, we use an {entry_date} tag to pull the date the article or guide was created. As you can see we are using a lot of formatting parameters with this tag, so we’ll go through what they do next.

Let us look closer at the {entry_date} tag:

  1. The entry_date:relative parameter tells ExpressionEngine that we want to use relative dates, e.g. X hours ago or X days ago.
  2. The units="days|hours" parameter means we want the relative dates used only when an entry is hours or days old. Not for entries that are weeks, months, or years old. If an entry is older, we show the actual date.
  3. The stop="+3 day" parameter means we want the relative dates to only be shown for entries that are up to three days old. If an entry is four days old or more, we want to show the actual date.
  4. The format="%F %j, %Y" parameter defines how actual dates are shown. This is where you can localize and format the date.
  5. And finally, the about="" parameter is set to blank. If we wanted to, we could have ExpressionEngine show the relative dates with a word in front like about 2 days old or nearly 2 years old. However, we choose not to use this feature, so we set it to blank. If we leave out this parameter entirely, ExpressionEngine will use the word about by default.

Note: One of the things that make ExpressionEngine so incredibly flexible is that almost all tags have lots of parameters, variables, and conditionals available. That means you can tailor what data the tag will pull, under what circumstances it will pull them, and how it will present those data.

Take the date-related tags we are using in this guide as an example. You will probably never encounter a date or time you can’t pick apart or format exactly how you want.

Another example is the most used tag in ExpressionEngine, the Channels Entries tag. There is nothing this tag can’t be made to do. If the data exists, it will let you use them exactly how you want to!

Dates on article pages

We also show dates on single entry pages like the one you are reading now. At the bottom, we show the author’s name, the date the entry was posted, and the date it was last updated. But only if it has been updated.

The code for this is:

<div class="metainfo">
    <p><strong>Author</strong>: {author}</p>
    <p><strong>Posted</strong>: {entry_date format="%F %j, %Y"}{if "{edit_date format='%Y-%m-%d'}" != "{entry_date format='%Y-%m-%d'}"} | <strong>Updated</strong>: {edit_date:relative units="days|hours" about="" stop="+3 day" format="%F %j, %Y"}</p>{/if}

Let us run through this code too:

Note: Again, this all takes place within the Channel Entries tag that creates the page content. It has to, or ExpressionEngine would not know from which entry it should pull the author and dates.

  1. First, we have a div so we can format this section with CSS independently.

  2. Then we pull the author of the article with ExpressionEngine’s {author} tag.

  3. Like before, we then use an {entry_date} tag to pull the date the article or guide was created. See above for more info on this tag and its parameters.

  4. And finally, we have the following conditional:

    {if "{edit_date format='%Y-%m-%d'}" != "{entry_date format='%Y-%m-%d'}"} | <strong>Updated</strong>: {edit_date:relative units="days|hours" about="" stop="+3 day" format="%F %j, %Y"}</p>{/if}

    This tests if {edit_date format='%Y-%m-%d'} is different from {entry_date format='%Y-%m-%d'}.

    If it is, meaning the entry has been updated since it was first posted, we show that date.

    We also show a pipe character ( | ) and an “Updated:” text to separate the two dates. You can see this in action in the timestamps at the end of this guide.

    Important: When comparing the edit and entry date, you must use the format= parameter to convert the two timestamps, as we do in the code above.

    If you just compare {edit_date} to {entry_date} ExpressionEngine will compare the two timestamps as UNIX time. This is a ten-digit integer that is precise down to the second. And since the entry date is when you created the entry in ExpressionEngine’s control panel, and edit date is when you saved it from the control panel, these timestamps will always be different. Even if you create a new entry and publish it right away.

    So you need to lower the resolution of the two timestamps with the format= parameter, or all your entries will look “updated”, even those that you have never changed.

  5. OK, finally, we close our div.

And that is how we handle dates here on the site. If you have comments or suggestions, please leave a comment.

Thank you for reading!

Author: Thomas Boelskifte

Posted: August 15, 2021 | Updated: August 19, 2021


Write a Comment:

Note: You can use markdown for your comment.