Jump to:

23486 Posts in 18995 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » Date months in locale

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1
Go to End
Author Topic: 594 Views
  • Webdoc
    Avatar
    Community Member
    332 Posts

    Date months in locale Link to this post

    How to get the month names in current locale
    SS 2.4.7

  • Willr
    Avatar
    Forum Moderator
    5508 Posts

    Re: Date months in locale Link to this post

    Well $Now.Month returns the month name. It will return whatever locale you have set at the PHP level (setlocale()) I don't believe SS will set this automatically for you.

  • Webdoc
    Avatar
    Community Member
    332 Posts

    Re: Date months in locale Link to this post

    i use in mysite/_config.pgp lines:
    i18n::set_locale('et_EE');
    setlocale(LC_TIME, i18n::get_locale() . '.utf8');

    But in blog module the months are still in english.
    Blog module uses in posts:
    $Date.Long
    And in widget it also in english

  • Webdoc
    Avatar
    Community Member
    332 Posts

    Re: Date months in locale Link to this post

    got it working with code $Date.FormatDate(%d %b %Y)
    But still needed the code do make ArchiveWidget to show the title in right language

    594 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.