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 <[email protected]> The highway is for gamblers,
San Francisco Bay Area, California better use your sense - B. Dylan
------------------------------------------------------
Mailman-Users mailing list [email protected]
https://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://wiki.list.org/x/AgA3
Security Policy: http://wiki.list.org/x/QIA9
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe:
https://mail.python.org/mailman/options/mailman-users/archive%40jab.org