Content last modified Monday 3 September 2018
hop to #bottom
Current version:
About It:
Get it:
Rate it:
  • Helpful?
  • 1 Yes
  • 0 No
Flag it:

If you'd like to provide updated information and do not have access to directly edit, please contact the site admin; thanks!



Textpattern has localized strings for almost everything, but dates are under servers responsibility. This is reasonable, since dates are more than just months/days names, but can be a problem if some locales are missing on the server.

This is where etc_date intervenes. It allows you to define your own date strings to display dates in the language of your choice. Moreover, you can use custom calendars, to transform 1799-11-09 into 18 Brumaire An VIII (though currently only Gregorian, Hijri and Jalali calendars are available).

Even if you do not need to localize dates, etc_date can come handy, since it understands expressions like today, next Friday, etc. Moreover, it includes <txp:etc_if_date /> and <txp:etc_date_diff /> tags, useful for dates comparison.


<txp:etc_date date="posted" calendar="hijri" lang="ar_AR" format="%d %B %Y" />
<txp:etc_if_date value="12-24..12-26" format="%m-%d">
	Merry Christmas!
<txp:etc_if_date date="expires" compare="now..+3 days" format="%s">
	This article expires in <txp:etc_date_diff from="yesterday" to="expires" /> days!
Article Request Count:
Initially released:
Posted here:
16 Jul 2013

You know you want to visit the Archives.
Published with Textpattern