更新时间:2021-09-21 15:49:42
DateTime
不包含时区信息,因此您无法在特定时区创建 DateTime
只有您系统的时区和 UTC 可用.
DateTime
doesn't contain timezone information therefore you can't create a DateTime
in a specific timezone only the timezone of your system and UTC are available.
您可以将 DateTime 包装在自定义类中,并将时区信息添加到包装器中.您还需要每个时区的偏移量表,然后从 UTC 日期添加/减去偏移量.
You can wrap the DateTime in a custom class and add timezone information to the wrapper. You also need a table of offsets for each timezone and then add/substract the offset from the UTC date.