<?php
// 示例代码:使用 strtotime 函数将自然语言日期转换为时间戳
// 当前时间的时间戳
echo strtotime("now") . "\n";
// 解释:输出当前时间的时间戳
// 明天这个时候的时间戳
echo strtotime("tomorrow") . "\n";
// 解释:输出明天这个时候的时间戳
// 上午10点的时间戳
echo strtotime("10:00am") . "\n";
// 解释:输出今天上午10点的时间戳
// 一周后的时间戳
echo strtotime("+1 week") . "\n";
// 解释:输出一周后的时间戳
// 下个月的同一天的时间戳
echo strtotime("+1 month") . "\n";
// 解释:输出下个月的同一天的时间戳
// 下一年的同一天的时间戳
echo strtotime("+1 year") . "\n";
// 解释:输出下一年的同一天的时间戳
// 指定日期和时间的时间戳
echo strtotime("2023-10-05 14:30:00") . "\n";
// 解释:输出指定日期和时间的时间戳
?>
上一篇:php instanceof
Laravel PHP 深圳智简公司。版权所有©2023-2043 LaravelPHP 粤ICP备2021048745号-3
Laravel 中文站