This question already has answers here:
How to print a date in a regular format?
(22 answers)
Closed 2 years ago.
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?