""" Returns "st", "nd", "rd", or "th" as appropriate for the given day number. """ # Copyright © 2004 Saugus.net, Inc. # All Rights Reserved. # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. if day%10==1 and day%100!=11: suffix="st" elif day%10==2 and day%100!=12: suffix="nd" elif day%10==3 and day%100!=13: suffix="rd" else: suffix="th" return suffix