python date suffixes for strftime


/ Published in: Python
Save to your folder(s)

like PHP's 'jS'


Copy this code and paste it in your HTML
  1. if 4 <= day <= 20 or 24 <= day <= 30:
  2. suffix = "th"
  3. else:
  4. suffix = ["st", "nd", "rd"][day % 10 - 1]

URL: http://mail.python.org/pipermail/python-list/2005-July/333218.html

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.