On , I learnt ...

That Python’s datetime package doesn’t support ordinal suffixes for the day of the month

Django’s date template filter (and underlying django.utils.dateformat module) support using S as a format character for the English ordinal suffix for the day of the month.


As in:

{{ value|date:"jS F Y" }}

will render as something like:

2nd June 2022

However the S format character is not supported by the strftime and strptime functions of the standard library.

This is true of other languages too. Ordinal suffixes are not supported by the standard libraries of Golang, Java, Rust or Ruby either.

They are supported by PHP’s date function though. Indeed, this was the motivation for Django’s implementation.