[英]How to convert MySQL date time into ISO 8601 date format without offset?
我有以下MySQL日期时间:
2012-04-13 09:45:36
我正在使用将其转换为ISO 8601日期格式
date(DATE_ISO8601, strtotime('2012-04-13 09:45:36'));
它给了我以下输出:
2012-04-13T09:45:36+0100
如何获得没有偏移的输出,即没有+0100
我只想得到2012-04-13T09:45:36
如果删除偏移量后得到日期时间,是否会受到影响?
您必须使用所需的formatting参数来构建日期格式。
date(DATE_ISO8601, strtotime('2012-04-13 09:45:36'));
与date('Ymd\\TH:i:sO', strtotime('2012-04-13 09:45:36'));
相同date('Ymd\\TH:i:sO', strtotime('2012-04-13 09:45:36'));
。 如果删除O
参数(相对于GMT的偏移量),则会得到所需的结果:
date('Ymd\\TH:i:s', strtotime('2012-04-13 09:45:36'));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.