Mel VIP
Total posts: 126
31 Oct 2013 01:32

I need to show the date field from one Type in 2 different ways. See the example below. How can I do this? I’m not worried about the css and how it looks, just is it possible to have 2 different views?

Example “Thursday 31 October” as well as “Oct 31 Thur” in same article list view.

Last Modified: 02 Mar 2014


Sergey
Total posts: 13,748
31 Oct 2013 01:49

In template you can get mysql formated time like this

$item->fields_by_id[12]->value;

Where 12 is an ID of the field. This most probably an array and you will have to get first element.

$date = array_shift($item->fields_by_id[12]->value);

echo Jhtml::_('date', $date, 'F d, Y');

$time = strtotime($date);

echo date('D', $time);


Mel VIP
Total posts: 126
31 Oct 2013 18:49

Thanks Sergey, it works perfect..

Powered by Cobalt