Page 1 of 1

Calendar Date Format (it differs to the News Module...)

Posted: Thu Nov 16, 2006 5:58 am
by Darwin Web Design
Hi there,
I'm sorry to harp of this date format thing but I've done some research and it seems the calendar and news modules handle date formatting differently.  The news module was easy enough to modify but I am having a huge headache with the Calendar module - summary template.  I've searched the forum to no avail.

I have worked out that I would like my date to appear on the UPCOMING TEMPLATE as:  Mon 15 November 06 and have worked out the code needed for this combination would be "%a %d %b %y".  The only problem is that the template code has 13 mentions of all sorts of different date formatting and I don't know which one to replace my preferred date ...

I've tried various combinations but nothing is working...  Any clues would be highly appreciated.  My code is below:

Code: Select all

{foreach from=$events key=key item=event}
	<div class="calendar-event">
	{assign var=month_number value=$event.event_date_start|date_format:"%m"}
	{assign var=end_month_number value=$event.event_date_end|date_format:"%m"}
	{if $event.event_date_start == $event.event_date_end || $event.event_date_end == ""}
	<h2>{$event.event_date_start|date_format:"%e"} {$month_names[$month_number]} 

{$event.event_date_start|date_format:"%Y"}</h2>
	{else}
	{if $event.event_date_start|date_format:"%d%m%Y" == 

$event.event_date_end|date_format:"%d%m%Y"}
	<h2>{$event.event_date_start|date_format:"%e"} {$month_names[$month_number]} 

{$event.event_date_start|date_format:"%Y %H:%M"} {$lang.to} 

{$event.event_date_end|date_format:"%H:%M"}</h2>
	{else}
	<h2>{$event.event_date_start|date_format:"%e"} {$month_names[$month_number]} 

{$event.event_date_start|date_format:"%Y %H:%M"} {$lang.to} 

{$event.event_date_end|date_format:"%d"} {$month_names[$end_month_number]} 

{$event.event_date_end|date_format:"%Y %H:%M"}</h2>
	{/if}
	{/if}
	{if $event.event_summary !="" && ($detail != 1 || ($event.event_details =="" ||  

$event.event_details == "<br />"))}
<div class="event-title">{$event.event_title}</div>
		<div class="calendar-summary">{$event.event_summary}</div>
	{/if}
	{if $detail == 1}
		{if $event.event_details !="" && $event.event_details != "<br />"}
		<div class="calendar-details"><span 

class="calendar-details-title">{$lang.details}: </span>{$event.event_details}</div>
		{/if}
	{else}
		{if $event.event_details !="" && $event.event_details != "<br />"}
		<a href="{$event.url}">{$moretext}</a>
		{/if}
	{/if}

	</div>
{/foreach}

{if $return_url != ""}
<div class="calendar-returnlink">{$return_url}</div>
{/if}
Thanks  ???

Re: Calendar Date Format (it differs to the News Module...)

Posted: Sat Jan 27, 2007 1:43 am
by heatherfeuer
Did you ever figure out how to change the date format?  I've been dealing with the same thing and it appears you need to change every instance of date_format you find in the template.  It really is a trial and error process when you don't really know PHP very well!

Re: Calendar Date Format (it differs to the News Module...)

Posted: Sat Jan 27, 2007 1:40 pm
by Darwin Web Design
Hello
Yes I did figure it out and you're right it was a lot of trial and error.  Unfortunately as it was back in November, I can't remember what I did exactly but if it is urgent, let me know and I might be able to post the template.  8)

Re: Calendar Date Format (it differs to the News Module...)

Posted: Sat Jan 27, 2007 2:28 pm
by heatherfeuer
Thanks for the offer, but let me see what I can do for now.  For one thing, I want the US date format of month, day, year.  And by doing the trial and error, I'm also becoming more familiar with PHP code (which most of this is...).  I figure that right now I know just enough to get myself into trouble!!  ;D ::) :P