在Python中操作日期和时间之gmtime()方法的使用,pythongmtime
在Python中操作日期和时间之gmtime()方法的使用,pythongmtime
gmtime()方法转换历元到一struct_time以UTC其中dst的标志值始终为0以秒表示时间。如果不设置秒时或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中的localtime()方法使用详解,pythonlocaltime
- 在Python中操作时间之mktime()方法的使用教程,pythonmkti
- Python3读取UTF-8文件及统计文件行数的方法,
- Python3处理文件中每个词的方法,
- python实现数组插入新元素的方法,python新元素
- python实现的简单抽奖系统实例,python抽奖实例
- linux下python抓屏实现方法,python抓屏
- python使用reportlab实现图片转换成pdf的方法,
- Python中用sleep()方法操作时间的教程,pythonsleep
- 详解Python中的strftime()方法的使用,pythonstrftime
评论关闭