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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Localization of the date


Go to End


4 Posts   2587 Views

Avatar
WebSpilka

Community Member, 89 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, 4102 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