时间戳格式化 PHP 为给定的特定格式
Timestamp formatting PHP to a specific format given
我试图简单地格式化 php $_POST 中的时间戳以格式化“MonthName dd, yyyy, hh:mm am/pm”
全局 post 变量是 $_POST['Time'],它保存我的时间戳,目前显示默认格式“2021-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
我试图简单地格式化 php $_POST 中的时间戳以格式化“MonthName dd, yyyy, hh:mm am/pm”
全局 post 变量是 $_POST['Time'],它保存我的时间戳,目前显示默认格式“2021-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