Created
December 15, 2016 12:07
-
-
Save neoshrew/12beafc269e224a84186cc23e2be7b44 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime | |
import pytz | |
def rfc822_dt_format(dt): | |
assert isinstance(dt, datetime.datetime) | |
if dt.tzinfo is None: | |
dt.replace(tzinfo=pytz.utc) | |
return dt.strftime('%a, %d %b %Y %H:%M:%S %z') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment