Giorgi625 VIP
Total posts: 655
14 Дек 2017 09:50

I need to display Year from datetime field which input format is dd/mm/yyyy

How can I get title like this Record Title (yyyy)

Also same result needed when used range of two dates in datetime field to get year from second date.

And last question: If I display date and age in record, can I display age in title this way?

PS. As I know if I change composite title structure I need to use reindex tool to display new titles in frontend right? or will I need to edit/save each record?

Последние изменения: 15 Фев 2018


Sergey
Total posts: 13,748
21 Янв 2018 06:57

Unfortunately reindex, does not update composite titles.

for date in title try [12::0] or [12::0] - [12::1]. Where:

  • 12 - ID fo the field
  • 0 - first date
  • 1 - last date

Giorgi625 VIP
Total posts: 655
21 Янв 2018 11:14

This [12::0] displays full date like this 2009-12-27 . Can I leave only year?

I tried another way: I have overriden in date field record creation time. Then checked if it was really overriden and it was, record which was added few weeks ago displays creation time 2009-12-17 which is date field value and its good. Then I added [DATE::Y] shortcode to title but it displays 2018 after title not 2009.

What can be done?

But even if I give up and use date field value using this shortcode [12::0], it will display this way 2009-12-27 but why? Everywhere I have set this markup for date dd-mm-YYYY

PS. If I used date field as birthdate and display in record like this [DATE] [AGE] can I get only age in composite title?


Sergey
Total posts: 13,748
12 Фев 2018 12:51

Unfortunately I cannot format in in composite title. In the code there title is formed, it doe snot even know what field it is.

What we are talking right now are filters for values. Something like this [12:0|lowcase]. That is getting too complicated.

Why cannot you use pseudo composite title?


Giorgi625 VIP
Total posts: 655
14 Фев 2018 11:27

In pseudo do you mean to add field code after title in template?

It's good solution but here is a question, can I change date field output directly in template code? as I will display in field list release date with output view DD-MM-YYYY, after title I want to display same field but only YYYY output.


pepperstreet VIP
Total posts: 3,837
15 Фев 2018 01:21

Giorgi625 after title I want to display same field but only YYYY output.

I guess, you can apply a method from this topic... and format the raw value of the date/time field:

$item->fields_by_id[99]->value

Работает на Cobalt