我如何将此2020-02-15T14:00:00Z字符串转换为php中的日期/时间格式[重复]

问题描述 投票:-1回答:1

[我正在使用一种API,在其中我获得此DateTime格式为“ 2020-02-15T14:00:00Z”,如何在php中像16个小时前一样转换此格式。

php datetime json-api
1个回答
0
投票
$date = '2020-02-15T14:00:00Z';
$fixed = date('d-m-Y', strtotime($date));

echo($fixed); // '15-02-2020'
© www.soinside.com 2019 - 2024. All rights reserved.