Patch: Display localized time and date with htmltmpl
Sam Ruby
rubys at intertwingly.net
Fri Sep 11 03:43:50 EST 2009
Lars Ljung wrote:
>
> def Rfc822(value):
> - return time.strftime("%a, %d %b %Y %H:%M:%S +0000", value)
> + wday = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
> + mon = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug',
> 'Sep', 'Oct', 'Nov', 'Dec']
> + return '%s, %02d %s %04d %02d:%02d:%02d +0000' % (wday[value[6]],
> value[2], mon[value[1]-1], value[0], value[3], value[4], value[5])
RFC 822 is very specific, with no substitutions allowed.
I localize dates and times on my planet using javascript.
http://planet.intertwingly.net/
http://intertwingly.net/code/venus/themes/asf/personalize.js
- Sam Ruby
More information about the devel
mailing list