RE: Small patch for more date information
"Blake Winton" <blake-dlUKtbW3TlBcVw/[email protected]>
| Newsgroups | gmane.comp.web.pyblosxom.user |
|---|---|
| Message-ID | <[email protected]> |
> I think nthday is ugly, no offence, I guess it could be done
> cleaner by calculating what comes after a number instead.
>
> # Get the postfix of the number
> th_day = {None:'th', 1:'st', 2:'nd', 3:'rd']
> day_digit = int(self['da']) % 10
> if th_day.has_key(day_digit): day_digit = None
> self['daord'] = self['da'] + th_day[day_digit]
11st? 12nd? 13rd? :)
Someone's already done this in their weblog comments.
http://simon.incutio.com/archive/2003/10/08/externalMemory
(I think the version by Brian Harnish is the canonical one.)
Later,
Blake.
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/