Problems, need help? Have a tip or advice? Post it here.
5 posts Page 1 of 1
Hey there!

I didn't want to bump or resurrect an old thread which had already been hijacked a few times, so I'm starting a new one.

I got the datetime explanation from the following thread :

viewtopic.php?f=8&t=7126&start=20

What I would like to do is format datetime output from the standard numerical form to something like

D, F j, Y g:i a

or

Thursday, November 23rd, 2014 6:00 am

This is my datetime code I have. I have two identical fields, event_date and event_end_date, code is identical.

Code: Select all
<cms:editable
    type='datetime'
    name='event_date'
    label='Event  Date'
    allow_time='1'
    am_pm='1'
    months='January, February, March, April, May, June, July, August, September, October, November, December'
/>


I'm still pretty new at couch's markup, so I'm trying to format it using couch's date function

Code: Select all
<cms:date event_date format='D, F j, Y g:i a' />


I have this right after the editable datetime field for both event_date and event_end_date. Just looking at it I know I'm not doing something right, but like I said I'm pretty new to this.
Okay, I figured this out.

I stored the editable region as a variable using the <cms:capture> tag.

I stored each output as a custom named variable. Here is the code :

Code: Select all
<cms:capture into='custom_event_date' scope='global' >
    <cms:editable
    type='datetime'
    name='eventdate'
    label='Event Date'
    allow_time='1'
    am_pm='1'
    months='January, February, March, April, May, June, July, August, September, October, November, December' />
</cms:capture>
<!-- This is the output, below -->
<cms:date custom_event_date format='D, F j, Y g:i a' />


It is the same code for my event_end_date which I made a variable named custom_event_end_date
Hey proofinlife,

Please define your editable region within the <cms:template>..</cms:template> block and you won't need to capture the data and stuff.
Simple
Code: Select all
<cms:date custom_event_date format='D, F j, Y g:i a' />
will work.
Okay, I have done that, and works great just as well.

Quick question, I have set up a search page, and it's working as expected, however, I have one little issue.

It's obviously pulling everything from whatever fields are set for the excerpt.

What is happening is, for my events section, I have a event_date and event_end_date set. In my search results for, say, "Board Meeting", which finds my board meeting event set, I'm getting my event date items listed in the raw YYYY-MM-DD format.

I'd either like to exclude these from being displayed in output, or I'd like to format them to match my date output I mentioned in my original post.

How can I go about doing this?
I'd either like to exclude these from being displayed in output,
I am sorry but for now we have little control over what gets shown in the search result (everything contained in text type regions get shown).

We have it on agenda to make it user-configurable, though.
5 posts Page 1 of 1