将Json日期转换为PHP日期格式? [英] convert Json date into PHP date formate?

查看:234
本文介绍了将Json日期转换为PHP日期格式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们如何转换2016-03-01T03:00:00Z这样的日期格式

How we convert2016-03-01T03:00:00Z this date format like

2016-03-01T03:00:00Z

进入01/02/2016 03:00 AM

还维护时区信息.

一种方法是将带有"T"字符但不符合'AM'和'PM'规范的字符串爆炸.

One method is to explode the string with "T" character but problem into the 'AM' and 'PM' specification.

推荐答案

您需要datestrtotime:

<?php
$a = "2016-03-01T03:00:00Z";
echo date("d/m/Y H:i A",strtotime($a));

?>

演示: http://codepad.org/O73INg7p

这篇关于将Json日期转换为PHP日期格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆