[Mailman-Users] {Disarmed} Re: Archive page not showing dates properly

Mark Sapiro mark at msapiro.net
Mon Aug 24 16:59:57 CEST 2015


On 08/24/2015 07:34 AM, Peter Wetz wrote:
> okay, sorry for the spam, but I already wrapped my head around how to
> change the date format.
> 
> just use python's functionality to parse it into a different string.
> for instance: 'date': datetime.datetime.strptime(article.datestr, "%a,
> %d %b %Y %H:%M:%S %z").strftime("%d %b %Y %H:%M:%S"),

Or, perhaps a bit simpler:

'date': datetime.datetime.fromtimestamp(article.date).strftime("%d %b %Y
%H:%M:%S")

or simpler still and not requiring import of datetime (HyperArch.py
already imports time

'date': time.strftime("%d %b %Y %H:%M:%S", time.localtime(article.date))

Note that the article instance has attributes

#  datestr  : The posting date, in human-readable format
#  date     : The posting date, in purely numeric format

-- 
Mark Sapiro <mark at msapiro.net>        The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan


More information about the Mailman-Users mailing list