How to get an UTC date string in Python? [duplicate]
问题 This question already has answers here : How to get UTC time in Python? (7 answers) How to print a date in a regular format? (22 answers) Closed last year . I am trying to get utc date string as "YYYYMMDD" For now I do the following, nowTime = time.gmtime(); nowDate = date(nowTime.tm_year, nowTime.tm_mon, nowTime.tm_mday) print nowDate.strftime('%Y%m%d') I used to do: datetime.date.today().strftime() but this gives me date string in local TZ How can I get an UTC date string? 回答1: from