带时区的日期格式 [英] date format with timezone
本文介绍了带时区的日期格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在python中格式化日期,使其看起来像这样: weekday:month:day(number):HH:MM:SS(military):EST/CST/PST:YYYY
?我对strftime()很熟悉,但是我不确定如何处理HH:MM:SS和EST/CST/PST.
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
推荐答案
使用 strftime
输出格式化的字符串表示形式:
Use strftime
to output a formatted string representation:
print time.strftime("%a %b %d %H:%M:%S %Z %Y")
这篇关于带时区的日期格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文