返回首页

如何表示各个时区的时间DateTime.ToString

275 2025-06-30 07:47 admin

找了半天资料,才找到原因

This profile defines two ways of handling time zone offsets:

有两种方式处理时区的时差

Times are expressed in UTC (Coordinated Universal Time), with a special UTC designator (Z).

如果是UTC时间的话,后面需要加Z表示。T13:15:30Z

Times are expressed in local time, together with a time zone offset in hours and minutes.

A time zone offset of +hh:mm indicates that the date/time uses a local time zone which is hh hours and mm minutes ahead of UTC.

A time zone offset of -hh:mm indicates that the date/time uses a local time zone which is hh hours and mm minutes behind UTC.

其它的时间,在年月日时分秒后面,通过+-时差来表示。

如果时间比UTC时间快的话,就用+hh:mm表示,后面的时间表示相差的时间。

如果时间比UTC时间慢的话,就用-hh:mm表示,后面的时间表示相差的时间。

+hh:mm和-hh:mm实际上表示的是时区,+08:00表示的是东八区,-05:00表示的是西五区

有两种方式来说明时间

T08:15:30-05:00 corresponds to November 5, 1994, 8:15:30 am, US Eastern Standard Time.

//时间是 08:15:30 表示的是西五区的时间,比UTC时间慢5个小时 换算成UTC时间的话,需要加上5个小时,就是 13:15:30

T16:15:30+08:00 表示的是东八区的时间,比UTC时间快8个小时 换算成UTC时间的话,需要减去8个小时,就是 13:15:30

T13:15:30Z corresponds to the same instant.//很明显是UTC时间

顶一下
(0)
0%
踩一下
(0)
0%
相关评论
我要评论
点击我更换图片
上一篇:返回栏目