If you'd like to provide updated information and do not have access to directly edit, please contact the site admin; thanks!
etc_date
Description
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.
Usage
<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>
<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!
</txp:etc_if_date>