News Date Format

For discussion and questions related to CMS Specific templates and stylesheets (CSS), and themes. or layout issues. This is not a place for generic "I don't know CSS issues"
Locked
memarkiam

News Date Format

Post by memarkiam »

The default date format for the 'date added' in News is US format.

I'd actually like to have "4 October 2006", but at least it should be "dd-mm-yyyy" (not "mm-dd-yyyy")

Does anyone know how I can do this?

Many thanks.
Mark
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: News Date Format

Post by Dr.CSS »

Extensions > Modules click News or Help...

(optional) dateformat="%b %d, %Y" - Format to display the article's post date with. This is based on the strftime function and can be used in your template with $entry->formatpostdate. It defaults to %x, which is the default date format for the server's locale.
memarkiam

Re: News Date Format

Post by memarkiam »

Many thanks for this. Only thing is it doesn't seem to be making any difference. This is what I have:

{$entry->formatpostdate dateformat="%b %d, %Y"}

I am doing something wrong here?

Thanks,
Mark
Dee
Power Poster
Power Poster
Posts: 1197
Joined: Sun Mar 19, 2006 8:46 pm

Re: News Date Format

Post by Dee »

Looks OK... maybe the WYSIWYG changed the double quotes to "?
Try using single quotes instead.
Dee
Power Poster
Power Poster
Posts: 1197
Joined: Sun Mar 19, 2006 8:46 pm

Re: News Date Format

Post by Dee »

Hmm, the dateformat parameter should be used on the news module call, not inside the template:

Code: Select all

{news dateformat="%b %d, %Y"}
Dee
Power Poster
Power Poster
Posts: 1197
Joined: Sun Mar 19, 2006 8:46 pm

Re: News Date Format

Post by Dee »

Inside the template you could use Smarty's dateformat modifier:

Code: Select all

{$entry->formatpostdate|date_format:"%b, %d %Y"}
Regards,
D
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: News Date Format

Post by Dr.CSS »

All parameters shown in the Help are to be added to the 'tag' when used in template or page...
memarkiam

Re: News Date Format

Post by memarkiam »

Thanks very much Dee & Mark.

The Smarty dateformat modifier did it:

{$entry->formatpostdate|date_format:"%d %B %Y"}

gives me extaclty what I wanted.

Cheers!
Mark
Ulysses
Forum Members
Forum Members
Posts: 64
Joined: Sat Jan 27, 2007 11:41 pm

Re: News Date Format

Post by Ulysses »

I eventually found the dateformat code shown on "Extensions > Modules click News or Help..." mark mentioned on line 81 of modules/news/News.module.php and changed it to:

Code: Select all

$this->CreateParameter('dateformat', '%D %j %M %Y', $this->lang('helpdateformat'));
but this did not work.

In which file and where exactly should one make this mod.

Thanks
Locked

Return to “Layout and Design (CSS & HTML)”