xxxxxxxxxx
<html>
<head>
<meta charset="utf-8">
<title>PHP strtotime() 函数 实例 - 自学教程(runoops.com)</title>
</head>
<body>
// 设置时区
date_default_timezone_set("PRC");
$time = strtotime("2024-09-26 17:08:08"); // 将指定日期转成时间戳
// 打印当前时间 PHP_EOL 换行符,兼容不同系统
echo $time, PHP_EOL;
echo '<br />';
// 更多实例
echo strtotime("now"), PHP_EOL;
echo strtotime("now"), PHP_EOL;
echo strtotime("10 September 2000"), PHP_EOL;
echo strtotime("+1 day"), PHP_EOL;
echo strtotime("+1 week"), PHP_EOL;
echo strtotime("+1 week 2 days 4 hours 2 seconds"), PHP_EOL;
echo strtotime("next Thursday"), PHP_EOL;
echo strtotime("last Monday"), PHP_EOL;
</body>
</html>