Search code examples
pythoninternationalizationpython-babel

Python/Babel: Get locale-specific ordering of day, month and year?


Is there a way to get the day, month and year order for a locale in Babel? I am display three input fields for a date on a web page, and I would like to get the order correct based on the user's preferred language.

I know there is Locale.date_formats, but parsing date format strings to determine the order seems unreliable.


Solution

  • I think you have to parse the date formats – that's similar to how the CLDR data itself represents the "order" of date components.