How to display the word "Today" if the article was just published

Hi there.
I am using the code below to display when a page was published

[[*editedon:strtotime:date=`%d/%m/%y`]]

The result looks like something like this:
3 days ago, 2 months ago...

But when the article is published the same day, I get something like “3 sec ago… 5 min ago…”

Do you have any idea how I could add a conditional parameter such as for eg. if todays date => display “Today”.

Thanks a lot!

Try this (untested):

[[*editedon:ago]]

It won’t display ‘today,’ but it might be better than what you’re doing.

Try this also, to see if it works better for you:

[[*editedon:fuzzydate]]

Is there a reason you’re using editedon instead of publishedon?

1 Like

If the output filters that Bob suggested don’t give you the result you want, you can create your own custom output filter.

Maybe look at the code of the built-in output filters and do something similar:


By the way, [[*editedon:strtotime:date=`%d/%m/%y`]] should create and output like 19/04/22.

1 Like

@bobray I actually use both on my template. I will try your code and get back to you.

@halftrainedharry Sorry I meant [[*editedon:date=%Y-%m-%d %H:%M:%S:ago]]

So I’m back.
Fuzzydate does a much better job than ago! Thanks a lot.