Message146554
| Author |
burak.arslan |
| Recipients |
burak.arslan |
| Date |
2011年10月28日.12:06:34 |
| SpamBayes Score |
9.890443e-05 |
| Marked as misclassified |
No |
| Message-id |
<1319803595.43.0.202651684081.issue13284@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
turns out timetuple was not passing timezone information. the correct way of converting a datetime.datetime object to a correct rfc-2822 compliant date string seems to be:
email.utils.formatdate(time.mktime(a.utctimetuple()) + 1e-6 * a.microsecond - time.timezone)
what a mess. if the above is indeed the right way to do this, is it possible to add the following function to the email.utils module?
def formatdatetime(dt_object):
return email.utils.formatdate(time.mktime(dt_object.utctimetuple()) + 1e-6 * a.microsecond - time.timezone)
this works for datetime instances both with and without time zone information.
ps: i updated the code in the github link but not here. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2011年10月28日 12:06:35 | burak.arslan | set | recipients:
+ burak.arslan |
| 2011年10月28日 12:06:35 | burak.arslan | set | messageid: <1319803595.43.0.202651684081.issue13284@psf.upfronthosting.co.za> |
| 2011年10月28日 12:06:34 | burak.arslan | link | issue13284 messages |
| 2011年10月28日 12:06:34 | burak.arslan | create |
|