且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将日期转换为T Z格式

更新时间:2023-11-29 13:20:52

这应该在Z(ulu)时区中给出正确的ISO8601日期/时间:

This should give the proper ISO8601 date/time in Z(ulu) timezone:

str_replace('+00:00', 'Z', gmdate('c'))

要进行日期转换:

str_replace('+00:00', 'Z', gmdate('c', strtotime('2013-05-07 18:56:57')))

拥有附加的.000(这是无用的恕我直言):

To have the additional .000 (which is useless imho):

str_replace('+00:00', '.000Z', gmdate('c', strtotime('2013-05-07 18:56:57')))