日期时间与时间模块之间的差异 [英] difference between datetime vs time modules

查看:105
本文介绍了日期时间与时间模块之间的差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道datetime提供日期和时间。什么时候使用模块?有什么区别吗这可能看起来很幼稚,但是我想弄清楚差异,应该使用什么。



例子将不胜感激,时区的差异特别有意义。



谢谢。

解决方案

时间模块主要用于使用unix时间戳;表示为从unix纪元开始的秒数的浮点数。 datetime 模块可以支持许多相同的操作,但提供了一个更面向对象的类型集,并且还对时区有一些有限的支持。


I know that datetime provides both dates and time. What is the use of the time module? are there any differences? This might seem naive but, I am trying to figure out the differences, and what each should be used for.

Examples would be appreciated, differences concerning timezones would especially of interest.

Thanks.

解决方案

the time module is principally for working with unix time stamps; expressed as a floating point number taken to be seconds since the unix epoch. the datetime module can support many of the same operations, but provides a more object oriented set of types, and also has some limited support for time zones.

这篇关于日期时间与时间模块之间的差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆