mccutchen / strftime.org

A single-serving-site that provides a reference for Python's strftime formatting options
https://strftime.org/
584 stars 307 forks source link

Adding Suffix to Day e.g 5th #30

Closed thayeylolu closed 3 years ago

thayeylolu commented 3 years ago

29

Hello @mccutchen . Thank you for sharing the link, but it does not contain what I am looking for. I meant to ask if strftime allows formatting a date with a suffix. Formatting examples like: May 5th, Jan 1st . I know it allows formatting like May 5, and Jan 1

mccutchen commented 3 years ago

Hello again! If the Python strftime docs do not contain what you are looking for, then what you are looking for is not part of the Python standard library's strftime functionality and you will need to implement it yourself or find a 3rd party package that implements it for you.

In general, opening issues on this repo is not the best place to find the answers you're looking for. Please check out the resources under Got a Python problem or question? on the official Python language help documentation: https://www.python.org/about/help/#got-a-python-problem-or-question

I tend to use a search engine + Stack Overflow to answer questions like this. For example, a search for "python add ordinal suffix to datetime" yields some interesting results, including these Stack Overflow discussions of the exact question you have:

In short: you can't do this without writing some custom code.