Page 1 of 1
News Date Format
Posted: Wed Dec 20, 2006 2:14 pm
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
Re: News Date Format
Posted: Wed Dec 20, 2006 6:23 pm
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.
Re: News Date Format
Posted: Wed Dec 20, 2006 6:37 pm
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
Re: News Date Format
Posted: Wed Dec 20, 2006 7:10 pm
by Dee
Looks OK... maybe the WYSIWYG changed the double quotes to "?
Try using single quotes instead.
Re: News Date Format
Posted: Wed Dec 20, 2006 7:12 pm
by Dee
Hmm, the dateformat parameter should be used on the news module call, not inside the template:
Re: News Date Format
Posted: Wed Dec 20, 2006 7:14 pm
by Dee
Inside the template you could use Smarty's
dateformat modifier:
Code: Select all
{$entry->formatpostdate|date_format:"%b, %d %Y"}
Regards,
D
Re: News Date Format
Posted: Thu Dec 21, 2006 4:24 am
by Dr.CSS
All parameters shown in the Help are to be added to the 'tag' when used in template or page...
Re: News Date Format
Posted: Thu Dec 21, 2006 12:25 pm
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
Re: News Date Format
Posted: Sun Jan 28, 2007 12:03 am
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