Forums / Cotonti / Support / Shorter date

Twiebie
#1 2011-10-12 05:13

Hi,

Is there a way to display a shorter date?

Currently in for example recentitems it outputs the time/date with {PAGE_ROW_DATE} and looks like 12-10-2011 09:00
Is it possible to display the date without the time behind it? (12-10-2011)

I've checked the tags via tpl_debug but couldn't find a solution.

Tnx.

Trustmaster
#2 2011-10-12 05:33

Use callbacks:

{PAGE_ROW_DATE_STAMP|cot_date('d-m-Y', $this)}
or
{PAGE_ROW_DATE_STAMP|cot_date('date_full', $this)}
May the Source be with you!
Twiebie
#3 2011-10-12 05:37

Tnx for the quick reply, Trustmaster!

This post was edited by Twiebie (2011-10-12 06:57, 12 years ago)
GHengeveld
#4 2011-10-12 12:25
Formats like date_full are recommended since they are localized. See the locale file, they are defined in there.

Added 1 hour later:

I wrote an article about it for future reference: How do I show dates and times in a different format?

This post was edited by GHengeveld (2011-10-12 13:54, 12 years ago)
Twiebie
#5 2011-10-19 13:54

Can these callbacks also be used with custom extra fields?

I use a custom field named {LIST_ROW_AGENDADATE} for date/time in a list, and i've tried a callback like this:

{LIST_ROW_AGENDADATE_STAMP|cot_date('date_fulltext', $this)} 

but this results in the default time (Thursday, January 01, 1970) instead of the date that is set in the custom field.

Added 2 days later:

Anyone?

This post was edited by Twiebie (2011-10-22 10:45, 12 years ago)
esclkm
#6 2011-10-22 11:35

Please Insert in tickets extrafields date stamp

littledev.ru - мой маленький зарождающийся блог о котонти.
снижение стоимости программирования и снижение стоимости производства разные вещи. Первое можно скорее сравнить с раздачей работникам дешевых инструментов, чем со снижением зарплаты