date format with timezone
问题 How do I format a date in python to look like this: weekday:month:day(number):HH:MM:SS(military):EST/CST/PST:YYYY ? I am familiar with strftime(), but I am unsure how I would handle the HH:MM:SS and EST/CST/PST. example of how I am trying to get the date to look: Sun Mar 10 15:53:00 EST 2013 回答1: Use strftime to output a formatted string representation: print time.strftime("%a %b %d %H:%M:%S %Z %Y") A list of the format codes can be found here 回答2: from time import gmtime, strftime print