描述
Pythom時間法gmtime()將自紀元以來以秒表示的時間轉換為 UTC 中的 struct_time,其中 dst 標誌始終為零。如果未提供 secs 或 None,則使用 time() 返回的當前時間。
用法
以下是語法gmtime()方法≫
time.gmtime([ sec ])
參數
sec─這些是要轉換為結構 struct_time 表示的秒數。
返回值
此方法不返回任何值。
示例
下麵的例子展示了 gmtime() 方法的用法。
#!/usr/bin/python
import time
print "time.gmtime():%s" % time.gmtime()
當我們運行上麵的程序時,它會產生以下結果——
time.gmtime():(2009, 2, 17, 17, 3, 38, 1, 48, 0)
相關用法
- Python time ctime()用法及代碼示例
- Python time mktime()用法及代碼示例
- Python time localtime()用法及代碼示例
- Python time sleep()用法及代碼示例
- Python time strftime()用法及代碼示例
- Python time clock()用法及代碼示例
- Python time asctime()用法及代碼示例
- Python time altzone()用法及代碼示例
- Python time tzset()用法及代碼示例
- Python time time()用法及代碼示例
- Python time replace()用法及代碼示例
- Python time strptime()用法及代碼示例
- Python time.monotonic()用法及代碼示例
- Python time.asctime()用法及代碼示例
- Python time.ctime()用法及代碼示例
- Python time.perf_counter()用法及代碼示例
- Python time.get_clock_info()用法及代碼示例
- Python time.gmtime()用法及代碼示例
- Python time.time()用法及代碼示例
- Python time.mktime()用法及代碼示例
注:本文由純淨天空篩選整理自 Python time gmtime() Method。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。