Keyword

ExtraField in Cat View with modfied Date Format

More
10 years 11 months ago #120054 by Sean
I am creating a K2 based Event display. At my category view I would like to display the date for the event, taken from an extra field.

<?php echo $this->item->extraFields->Start->value;?>

To this point I am successful. Next I need to change the date format, to "j M Y". Also, for the intended display, I would like to separate "j" "M" and "Y" so I can style them individually. The idea is to have three div's each output a single piece of the date. The final look will be a big date that displays beside each event. See below.

1
Jan
2013

So I used the following code:

<div class="day"><?php echo JHTML::_('date', $this->item->extraFields->Start->value, "j"); ?></div>
<div class="month"><?php echo JHTML::_('date', $this->item->extraFields->Start->value, "M"); ?></div>
<div class="year"><?php echo JHTML::_('date', $this->item->extraFields->Start->value, "Y"); ?></div>

This works, but with the following issue. The date displays a day earlier than the actual Extra Field date. When i use just this code:

<?php echo $this->item->extraFields->Start->value;?>

The output is correct, however not in the correct date format. This leads me to believe there is an issue when attempting to modify the date format in my code.

Is anyone aware of any possible sources for this issue? How can I resolve this issue or accomplish my main task?

Any help would be greatly appreciated.

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

More
10 years 11 months ago #120055 by Sean
I forgot to mention versions..

Joomla v 3.1.5
K2 v 2.6.7

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

  • Mohamed Abdelaziz
  • Mohamed Abdelaziz's Avatar
  • Offline
  • Platinum Member
  • Joomla Developer
More
10 years 11 months ago #120056 by Mohamed Abdelaziz
Replied by Mohamed Abdelaziz on topic Re: ExtraField in Cat View with modfied Date Format
Hi,

I'm not sure, but you can check anyway whether your server is in a different time zone, so you need to adjust the time offset.

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.

More
10 years 11 months ago #120057 by Sean
I have adjusted my timezone settings several times to verify if it would affect the date shown from my extra field. No matter what setting I chose, there was no change in the output.

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
10 years 11 months ago #120058 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: ExtraField in Cat View with modfied Date Format
I will try to confirm and recreate the issue and I will let you know.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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


Powered by Kunena Forum