Created
June 22, 2015 19:53
-
-
Save infinity0/e9d6fe71c1827ce0f088 to your computer and use it in GitHub Desktop.
RFC2822 to ISO8601 date converter
This file contains 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
#!/usr/bin/python | |
# RFC2822 to ISO8601 date converter, that doesn't require you to fuck with the TZ variable. | |
# Fuck the POSIX time functions. | |
import time, email.utils, sys | |
t = email.utils.parsedate_tz(sys.argv[1]) | |
t, tz = t[:-1], t[-1] | |
print(time.strftime("%Y-%m-%dT%H:%M:%S", t) + "{0:+03d}{1:02d}".format(tz/3600, tz/60%60)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment