本文整理汇总了Python中DateTime.DateTime.__getstate__方法的典型用法代码示例。如果您正苦于以下问题:Python DateTime.__getstate__方法的具体用法?Python DateTime.__getstate__怎么用?Python DateTime.__getstate__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DateTime.DateTime
的用法示例。
在下文中一共展示了DateTime.__getstate__方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: int
# 需要导入模块: from DateTime import DateTime [as 别名]
# 或者: from DateTime.DateTime import __getstate__ [as 别名]
tod_int = int(math.floor(tod))
ms = tod - tod_int
hr,mn,sc = _calcHMS(tod_int, ms)
if not tz:
# Figure out what time zone it is in the local area
# on the given date.
x = _calcDependentSecond2(year,month,day,hr,mn,sc)
tz = self._calcTimezoneName(x, ms)
return year,month,day,hr,mn,sc,tz
DateTimeKlass._parse = DateTime_parse
if __name__ == '__main__':
for i in ('2007/01/02 12:34:56.789',
'2007/01/02 12:34:56.789 GMT+0200',
'2007/01/02 12:34:56.789 JST',
'2007/01/02 12:34:56.789 +0300',
'2007/01/02 12:34:56.789 +0430',
'2007/01/02 12:34:56.789 +1237',
):
a = DateTimeKlass(i)
b = DateTimeKlass()
b.__setstate__(a.__getstate__())
print a, a.__dict__ == b.__dict__
for i in a.__dict__.keys():
if a.__dict__[i] != b.__dict__[i]:
print i, a.__dict__[i], b.__dict__[i]