我正在构建一项PHP服务,该服务将允许用户单击其移动设备上的Add to calendar
按钮。将日期时间转换为PHP日历中的通用时间戳
如何将2009-09-12 15:00
转换为示例时间戳我使用PHP给出了20091109T101015Z
?
我玩过strtotime
gmdate
但我想我只是缺少正确的格式参数。
感谢
我正在构建一项PHP服务,该服务将允许用户单击其移动设备上的Add to calendar
按钮。将日期时间转换为PHP日历中的通用时间戳
如何将2009-09-12 15:00
转换为示例时间戳我使用PHP给出了20091109T101015Z
?
我玩过strtotime
gmdate
但我想我只是缺少正确的格式参数。
感谢
试试这个:
$date = '2009-09-12 15:00';
$formatted_date = gmdate('Ydm\THis\Z', strtotime($date));
你尝试使用格式化?
$date = new DateTime("2009-09-12 15:00");
$formated = $date->format("Ydm\THis\Z");
在这里你去:
$the_date = strtotime("2010-01-19 00:00:00");
echo(date_default_timezone_set("UTC") . "<br />");
echo(date("YmdTG:iz", $the_date) . "<br />");
跆拳道? “2009-09-12 15:00”如何映射到“20091109T101015Z”。假设月份和日期的顺序是颠倒的,这意味着在没有提供时区数据时会涉及时区转换。你如何从输入的4位数字中得到时间部分的6位精度? – symcbean