Date formatting for custom attributes in Page List template
Permalink
Hey all,
I've got a page type (event page) that lists 'start_date' and 'end_date' custom attributes via the date picker. I want to include those attributes in a custom template for the Page List Block. I'm able to achive the default date format, but am a little lost as to how to apply any custom formatting.
First I get the attributes:
then list them:
Which spits out the default - something like this: 2014-08-23 09:30:00 to 2014-08-30 14:30:00.
In my events page I'm using:
Which gives me something like August 23 2014, 9:30am TO August 30 2014, 2:30pm - and thats the date format I'm try to get into the Page List template.
Any thoughts on how I can do this?
I've got a page type (event page) that lists 'start_date' and 'end_date' custom attributes via the date picker. I want to include those attributes in a custom template for the Page List Block. I'm able to achive the default date format, but am a little lost as to how to apply any custom formatting.
First I get the attributes:
$startDate = $cobj->getAttribute('start_date'); $endDate = $cobj->getAttribute('end_date');
then list them:
Which spits out the default - something like this: 2014-08-23 09:30:00 to 2014-08-30 14:30:00.
In my events page I'm using:
Which gives me something like August 23 2014, 9:30am TO August 30 2014, 2:30pm - and thats the date format I'm try to get into the Page List template.
Any thoughts on how I can do this?
Thanks for taking the time - but no love - I get this on every entry (even ones without custom date attributes) - see attached image.
December 31, 1969 5:00pm to December 31, 1969 5:00pm
December 31, 1969 5:00pm to December 31, 1969 5:00pm
Yes! It does, thanks. Although if no attribute has been filled in for either start_date or end_date, the the same 1969 date appears...
http://php.net/manual/en/function.date.php...