它们描述了库函数^{}tz=None^{},这可能正是您想要的。在Return a datetime object with new tzinfo attribute tz, adjusting the date and time data so the result is the same UTC time as self, but in tz‘s local time.
它们有示例代码,用于根据与UTC的偏移量定义时区,并以如下声明结尾:Pacific = USTimeZone(-8, "Pacific", "PST", "PDT")
读了之后,你的问题是什么?在
你有date还是datetime?i、 e.数据有时区成分吗?如果没有时间成分,那么将日期更改为不同的时区意味着什么?在
你有“天真”还是“有意识”datetime?从文件上看An aware object has sufficient knowledge of applicable algorithmic and political time adjustments, such as time zone and daylight saving time information, to locate itself relative to other aware objects. An aware object is used to represent a specific moment in time that is not open to interpretation....
A naive object does not contain enough information to unambiguously locate itself relative to other date/time objects. Whether a naive object represents Coordinated Universal Time (UTC), local time, or time in some other timezone is purely up to the program, just like it is up to the program whether a particular number represents metres, miles, or mass. Naive objects are easy to understand and to work with, at the cost of ignoring some aspects of reality.
Python文档非常好。也许它可以回答你的问题而不必问StackOverflow。在