可以使用PHP中的date()函数将其转换为标准时间格式。具体步骤如下:

  1. 将时间字符串转换为时间戳,可以使用strtotime()函数实现。
$time_str = '25/11/2020下午4:00:00';
$timestamp = strtotime(str_replace(['下午', '上午'], ['pm', 'am'], $time_str));
  1. 使用date()函数将时间戳转换为标准时间格式。
$date_str = date('Y-m-d H:i:s', $timestamp);
echo $date_str;

最终输出结果为:2020-11-25 16:00:00。

PHP 转换非标准时间格式 (25/11/2020下午4:00:00) 为标准格式

原文地址: https://www.cveoy.top/t/topic/lBmM 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录