摘要:
下文讲述php中strtotime函数的功能说明,如下所示;
php之strtotime函数功能
php之strtotime函数:
将英文文本的日期或时间转换为unix时间戳
php之strtotime函数语法:
strtotime(time,now);
--------参数说明----
time:必填参数,待设置日期,时间字符串
now:非必填参数,设置用来返回值的时间戳,当省略此参数,则取当前时间
-------返回值说明-----
成功,则返回时间戳
失败,则返回FALSE
------注意事项-----
1.当年份使用两位数时,则0~69代表2000~2069
值70~100,则代表1970~2000
2. m/d/y 或 d-m-y 格式
例
php之strtotime函数的示例说明
echo "maomao365.com php strtotime函数示例分享\n";
echo(strtotime("now") . "\n");
echo(strtotime("20 October 2020") . "\n");
echo(strtotime("+3 hours") . "\n");
echo(strtotime("+2 week") . "\n");
echo(strtotime("+2 week 13 days 17 hours 30 seconds") . "\n");
echo(strtotime("next Monday") . "\n");
echo(strtotime("last Sunday"));
?>
//输出
maomao365.com php strtotime函数示例分享
1605104234
1603152000
1605115034
1606313834
1607498264
1605484800
1604793600