我正在尝试简单地格式化时间戳在php $_POST格式为"MonthName dd, yyyy, hh:mm am/pm">
全局post变量是$_POST['Time'],它保存我的时间戳,目前显示默认格式" 20121-09-25 18:17:36"....如何将此时间戳格式化为"MonthName dd, yyyy, hh:mm am/pm";格式吗?
<?php
// Figure out the format you want to convert to
$format = 'Y-m-d';
$date = date($format, strtotime($_POST['Time']));
这个页面包含了在PHP中格式化日期时字母的含义:https://www.php.net/manual/en/datetime.format.php