views:

63

answers:

1

Is there an out of the box way to format in python (or within django templates), a date with full month name in accordance to polish language rules?

I want to get:

6 września 2010

and not:

>>> datetime.today().date().strftime("%d %B %Y")
'06 wrzesień 2010'
+4  A: 

Use Babel:

>>> import babel.dates
>>> import datetime
>>> now = datetime.datetime.now()
>>> print babel.dates.format_date(now, 'd MMMM yyyy', locale='pl_PL')
6 września 2010

Update: Incorporated Nathan Davis' comment.

Vinay Sajip
Note: Use `d MMMM yyyy` (only one d) in the format string to eliminate the leading 0.
Nathan Davis