Forum

Thread tagged as: Question, Problem

Show same date field in multiple formats?

I am trying to output a date field in multiple formats like so:

<perch:content id="dayDate" type="date" label="Date" format="l jS F Y" required="true" native="true" />
<perch:content id="dayDayOfWeek" type="hidden" format="l" for="dayDate" />
<perch:content id="dayDayOfMonth" type="hidden" format="j" for="dayDate" />
<perch:content id="dayDayOfMonthSuffix" type="hidden" format="S" for="dayDate" />
<perch:content id="dayMonth" type="hidden" format="F" for="dayDate" />
<perch:content id="dayYear" type="hidden" format="Y" for="dayDate" />

No luck, unfortunately.

I know I could do the following...

<perch:content id="dayDate" type="date" label="Date" format="l jS F Y" required="true" native="true" />
<perch:content id="dayDate" type="date" format="jS" />

...but I am trying to give each date variant its own ID:

C'est possible?

Keir Moffatt

Keir Moffatt 0 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

I am trying to give each date variant its own ID

Why's that?

Was for some clever each processing but I've actually found a better way to do it with alternate templates, perch_content_custom and PHP's date() - Perch can skinneth the cat in many ways :)