2
只想使用'datetime'或'time'模塊。我根據以下代碼this問題:在python中的Rfc 1123
import time
def rfc1123 (gmt):
weekday = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"][gmt.tm_wday]
month = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"][gmt.tm_mon]
return "%s, %02d %s %04d %02d:%02d:%02d GMT" % (weekday, gmt.tm_mday, month, gmt.tm_year, gmt.tm_hour, gmt.tm_min, gmt.tm_sec)
print (rfc1123 (time.gmtime()))
有什麼問題嗎?我真的很擔心DST。
謝謝。
沒有funciona siempre,依賴del locale del sistema operativo。 – arivero 2013-11-25 16:41:03