date/time localization

Permalink
I wonder if its possible to return local date/time formats (german in my case) with the getCollectionDatePublic() method.

I need them as example for the page-list block for news entries on a website.

So the returned date months and days should be in german language. (ex. "Juli" instead of "July")

I am quite new to PHP OOP, but if I am not wrong it should be possible to modifier the getCollectionDatePublic() function with "strftime()" and the general concrete5 localization?!

Maybe the calendar add-on would be "fixed" with this as well?

Maybe you guys can help me out...

cheers
André

monobasic
 
michaelfm replied on at Permalink Reply
michaelfm
I'm currently stuck with this, as well.
Any ideas, or is there already a common solution for that?
zeker replied on at Permalink Reply
zeker
Hi everybody,
I've seen this question in other threads as well. But no answer so far.

I'm struggling with the same issue. I need to display date/time of a rss-feed in dutch.

So some php added to a custom template for the rss-displayer block would be enough. Unfortunatly I'm a newby to php.

Can anyone give a hint?

Thanx in advance.
Dutchwave replied on at Permalink Reply
Dutchwave
For the date/time attribute I used the following method. Haven't had a look at the RSS but maybe its an idea?

<?php $timestamp = strtotime($c->getCollectionAttributeValue('opgeleverd'));
$formattedDate = date('j F, Y',$timestamp);
// Vertaald de naam van de maand naar Nederlands.
$formattedDate = str_replace("January", "Januari", $formattedDate);
$formattedDate = str_replace("February", "Februari", $formattedDate);
$formattedDate = str_replace("March", "Maart", $formattedDate);
$formattedDate = str_replace("April", "April", $formattedDate);
$formattedDate = str_replace("May", "Mei", $formattedDate);
$formattedDate = str_replace("June", "Juni", $formattedDate);
$formattedDate = str_replace("July", "Juli", $formattedDate);
$formattedDate = str_replace("August", "Augustus", $formattedDate);
$formattedDate = str_replace("September", "September", $formattedDate);
$formattedDate = str_replace("October", "Oktober", $formattedDate);
$formattedDate = str_replace("November", "November", $formattedDate);
$formattedDate = str_replace("December", "December", $formattedDate);
PatrickHeck replied on at Permalink Reply
PatrickHeck
Put this in your template to get the date in localized format:
$date = $cobj->getCollectionDatePublic("U");
setlocale(LC_TIME, LOCALE);
echo strftime('%x',$date);

See the strftime docs for more options:http://php.net/manual/en/function.strftime.php...

EDIT: Just realized that the parameter "U" was missing and added it.