Keyword

Display the year from the date extra field

  • slawwwek
  • slawwwek's Avatar Topic Author
  • Offline
  • New Member
More
7 years 3 weeks ago #161289 by slawwwek
Hi,

In the article list, I display an additional date field with the code:

<?php echo ($item->extraFields->koniec->value); ?>

,effect: Monday, 28 marzec 2018.

Can you count on help modifying the above code to show only one year.

I do not want to change the display mode by modifications: K2_DATE_FORMAT_LC !

Please Log in or Create an account to join the conversation.

  • Mohamed Abdelaziz
  • Mohamed Abdelaziz's Avatar
  • Offline
  • Platinum Member
  • Joomla Developer
More
7 years 1 week ago #161356 by Mohamed Abdelaziz
Replied by Mohamed Abdelaziz on topic Display the year from the date extra field
Hi,

Try this one
<?php echo (JFactory::getDate($item->extraFields->koniec->value)->format("%Y")); ?>

For more information, please refer to this page: docs.joomla.org/How_to_use_JDate

Multiple Extra Fields Groups for K2
AutoMeta for K2
Chained Fields for K2
More K2 Extensions In My Extensions Store

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum