php - 如何将 publishedAt 转换为日期和时间
问题描述
我得到了 publishedAt 结果,Youtube API
但我想使用 php 将其转换为日期和时间,我该怎么做?
发表于:2018-08-14T14:30:02.000Z
解决方案
正如灰色所说,您可以使用 strtotime() 和 date() 来格式化日期。
$googleTime = '2018-08-14T14:30:02.000Z';
$strtotimeFormat = strtotime($googleTime);
$dateTimeFormat = date('Y-m-d H:i:s', $strtotimeFormat)
var_dump($dateTimeFormat)
输出:'2018-08-14 14:30:02'
推荐阅读
- javascript - 在现有的 React 项目中实现 babel/typescript
- mysql - ionic 和 mongodb 是必须的,还是我可以使用 mysql
- python-3.x - Django Admin 中的自定义 ModelForm
- laravel - JWT 认证总是返回 401 未授权
- javascript - 如何检查哪个选项卡处于活动状态?
- r - 在r中的一页中组合几个ggplot
- java - 围绕原点旋转“细胞”
- node.js - 无法读取未定义的属性“活动”
- java - 如何像在JavaFX中通过的信号一样为线条着色
- web-services - 如何在 OpenEdge Progress4GL 中将 XML 响应转换为临时表?