PHP 日期时间:转换为 UNIX 时间戳
将格式化日期转化为时间戳
PHP 函数 strtotime — 将任何字符串的日期时间描述解析为 Unix 时间戳
strtotime(string $datetime, int $now = time()): int
传入$datetime 即可将格式化时间转换为时间戳
$date = '2021-11-1 12:11:12';
echo strtotime($date) . "<br>";
// 输出 1635739872
$date = '2021年11月1日 12:11:12';
echo strtotime($date) . "<br>";
// 将没有任何输出或报错,不支持中文转换
$date = '2021/11/1 12:11:12';
echo strtotime($date) . "<br>";
// 输出 1635739872
echo date('Y年m月d日 H:i',strtotime($date));
// 输出 2021年11月01日 12:11