Heim  >  Artikel  >  Backend-Entwicklung  >  Python中用altzone()方法处理时区的教程

Python中用altzone()方法处理时区的教程

WBOY
WBOYOriginal
2016-06-06 11:17:151315Durchsuche

 altzone()方法是time模块的属性。当地的DST时区的这返回的偏移量,在UTC西部秒钟,如果一个定义。这是负值,如果当地的DST时区为UTC东边(如西欧,包括英国)。只有用这个,如果白天不为零。
语法

以下是altzone()方法的语法:

time.altzone

参数

  •     NA

返回值

当地的DST时区的这个方法返回的偏移量,在UTC西部秒钟,如果一个定义。
例子

下面的例子显示了altzone()方法的使用。

#!/usr/bin/python
import time

print "time.altzone %d " % time.altzone

当我们运行上面的程序,它会产生以下结果:

time.altzone() 25200

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn