2

The date field is displaying dates in US format (mm/dd/yyyy) but I need the UK (dd/mm/yyyy) format. According to the docs:

Dates and times are both formatted for the user’s preferred locale. They are displayed in the site’s timezone, however they get stored in UTC like all other dates in Craft.

How does one set this? The timezone is set correctly in the site config.

1
  • What locales do have you showing under Settings > Locales? Commented Nov 18, 2014 at 10:50

2 Answers 2

3

Dates and times are both formatted for the user’s preferred locale.

You have to select your "preferred locale" when installing Craft. If you chose the wrong one you (currently) can't undo it from the CP, but have to change it directly in the database (--> "craft_locales" table).

Another way would be to install a second locale (even if you don't need it at all). Because if your Craft site is multilingual you can switch between installed locales from the user settings in the CP though.

CP user settings - preferred locale

4
  • Thanks for answering. Currently, the 'preferredLocale' for both users is 'NULL'. Checked another Craft site I built and it's the same. Commented Nov 18, 2014 at 11:03
  • Sorry @hamish, corrected my answer.
    – carlcs
    Commented Nov 18, 2014 at 11:06
  • If you have more than one system locale installed you can then select it for each user. This can all be done via CP, see: glui.me/?i=a9q5btaremqgrl1/2014-11-18_at_11.06_(1).png and glui.me/?i=8y8kfmwwcd7vovr/2014-11-18_at_11.06.png Commented Nov 18, 2014 at 11:07
  • Whatever you do do not delete the original locale, and choose to assign the entries to the new locale. I just did this, and half the website content disappeared. Has to restore from backup. Commented Jul 15, 2016 at 19:11
0

You can see the specifics, albeit a bit tedious to browse one locale at a time, https://icu4c-demos.unicode.org/icu-bin/locexp, as to which each locale will display.

E.g. if one wished to have dates expressed YYYY-MM-DD (q.v. ISO 8601) you can browse each English language locale until you discovered that South Africa (en-ZA) does it this way.

Unfortunately, you then have to move to South Africa, of course, which can be rather expensive if you don't already live nearby. Small price to pay for having your dates expressed properly, however.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.