Keyword

Extra field date format in module

  • Margero Ramada
  • Margero Ramada's Avatar Topic Author
  • Offline
  • New Member
More
7 years 7 months ago - 7 years 7 months ago #157339 by Margero Ramada
Extra field date format in module was created by Margero Ramada
Hi,

I am using a module to display events created as items in the k2 component.
For the extra fields i have a field type date.

I have used the following code to fetch the extra fields information.
<?php
		$metas = ($item->extra_fields==null)?0:json_decode($item->extra_fields);
							
		if( (isset($metas[0]) && ($metas[0]->value !='')) ){
?>
<span>
<?php      if( isset($metas[0]) && $metas[0]->value != '' ) 
		echo $metas[0]->value ;
?>
</span>
		<?php }?>  

It will get the date shown in just numbers format. (2017-08-14)
I want it to be 14 august 2017.

I have noticed that in the item itself the date is being shown as follow: Monday, 14 august 2017.
So is this possible to be the same in a module?

Any ideas??

Thanks,
Last edit: 7 years 7 months ago by Margero Ramada.

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 7 months ago #157389 by Krikor Boghossian
Replied by Krikor Boghossian on topic Extra field date format in module

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

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

  • Margero Ramada
  • Margero Ramada's Avatar Topic Author
  • Offline
  • New Member
More
7 years 7 months ago - 7 years 7 months ago #157771 by Margero Ramada
Replied by Margero Ramada on topic Extra field date format in module
Hi Krikor,

The methods shown in those posts did not work in an external module.
I was able to make it work with
<span>
<?php if( isset($metas[0]) && $metas[0]->value != '' ) 
	echo date('d', strtotime($metas[0]->value)) ;
  ?>
</span>
<span>
<?php if( isset($metas[0]) && $metas[0]->value != '' )
    echo date('F', strtotime($metas[0]->value)) ;
?>
</span>
<span>
<?php if( isset($metas[0]) && $metas[0]->value != '' ) 
echo date('Y', strtotime($metas[0]->value)) ;
?>
</span>

But now the Month is being shown in English And i want it in Dutch.

Any ideas?
Last edit: 7 years 7 months ago by Margero Ramada.

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 7 months ago #157777 by Krikor Boghossian
Replied by Krikor Boghossian on topic Extra field date format in module
Stupid question here, have you correctly setup K2's and Joomla!'s languages?

Are the dates correct in the rest of the extension?

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