Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, biapar, Willr, Ingo, swaiba, simon_w

Localization of the date


Reply


4 Posts   1888 Views

Avatar
WebSpilka

Community Member, 83 Posts

5 October 2009 at 9:45am

Localization of the date
what to do to change the date format from
1 septembet 2009
at
1 Вересня 2009

I use
'Date' => 'Date',
and
new CalendarDateField('Date'),

in config.php
I write

Object::add_extension('SiteTree', 'Translatable');
Translatable::set_default_locale('uk_UA');


but this does not help

Avatar
denisrosset

Community Member, 4 Posts

11 October 2009 at 8:39am

I don't think there is a localization of the date printing in Silverstripe. You should look at the intl extension available beginning from PHP 5.3 (or PHP 5.2 using PECL).

Avatar
UncleCheese

Forum Moderator, 4096 Posts

12 October 2009 at 1:25am

Localized dates in PHP are generated with strftime() instead of date(). I believe there's a way to get access to that in the Date class. Look at Date.php for a function like i18nFormat().

Avatar
Juanitou

Community Member, 323 Posts

13 October 2009 at 2:43am

Try adding this line:

setlocale(LC_ALL, 'uk_UA.UTF8', 'uk_UA', 'uk-UA'); // Needed for dates