I've used dateutil
to convert the string 'Wed, 19 Dec 2012 01:34:52 -0800'
to date time datetime.datetime(2012, 12, 19, 1, 34, 52, tzinfo=tzoffset(None, -28800))
. How can I convert it to UTD+0 datetime.datetime(2012, 12, 19, 9, 34, 52)
?
使用.astimezone()
方法:
dt.astimezone(pytz.UTC)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.