By default, dates and times in Cotonti are formatted in a preconfigured way. While this works out fine in most cases, sometimes you will want to use a different format in your theme. Cotonti provides a simple way to achieve this using CoTemplate callbacks.
{PAGE_ROW_DATE_STAMP|cot_date('d-m-Y', $this)}
The cot_date()
function is very similar to the regular date function in PHP, with the addition of localized date formats. These formats are defined in $Ldt in main.en.lang.php. It's recommended to use these formats since they are more flexible. Here's an example:
{PAGE_ROW_DATE_STAMP|cot_date('date_full', $this)}
Here's a list of all the available localized date/time formats (default en_US locale):
Name | Format | Example |
---|---|---|
date_full | Y-m-d | 1988-06-18 |
date_medium | Y-m | 1988-06 |
date_short | m-d | 06-18 |
date_text | F d, Y | June 18, 1988 |
date_fulltext | l, F d, Y | Saturday, June 18, 1988 |
time_full | H:i:s | 08:45:00 |
time_medium | G:i | 8:45 |
time_short | i:s | 45:00 |
time_text | g:i A | 8:45 AM |
time_fulltext | g:i:s A | 8:45:00 AM |
datetime_full | Y-m-d H:i:s | 1988-06-18 08:45:00 |
datetime_medium | Y-m-d H:i | 1988-06-18 08:45 |
datetime_short | m-d H:i | 06-18 08:45 |
datetime_text | F d, Y H:i | June 18, 1988 08:45 |
datetime_fulltext | l, F d, Y H:i | Saturday, June 18, 1988 8:45 |
week_full | o-\WW | 1988-W24 * |
week_medium | \WW | W24 |
week_short | \WW-N | W24-6 |
week_text | \WW, l | W24, Saturday |
week_fulltext | o-\WW, l | 1988-W24, Saturday |
* If the ISO week number belongs to the previous or next year, that year is used.
For more information on date/time formatting, see the PHP documentation.
Thanked: 74 times
Very useful information, thanks!
Cool, but i think it will be better if admin of site can overwrite these formats by his custom theme|language file, because of update. Is it possible?
(sorry for my english)
Thanked: 263 times
It is possible, you can overwrite it in your theme language strings.
Thanked: 16 times
по этим форматам дат понятно, а вывести в разметку такого формата?
Thanked: 247 times
Как то так. Смотрите https://www.php.net/manual/ru/datetime.format.php