php strtotime()函数的用法
2020-06-29 17:19
197 查看
(注)strtotime()是把时间日期字符串转化为时间戳的格式,可以和date()一起使用。如:
[code]<?php echo(strtotime("now") . "<br>"); echo(strtotime("15 October 1980") . "<br>"); echo(strtotime("+5 hours") . "<br>"); echo(strtotime("+1 week") . "<br>"); echo(strtotime("+1 week 3 days 7 hours 5 seconds") . "<br>"); echo(strtotime("next Monday") . "<br>"); echo(strtotime("last Sunday")); ?>
输出:
1593421414
1473004800
1593439414
1594026214
1594310619
1593964800
1593273600
与date()一起使用
echo date('Y-m-d', strtotime( '-5 day', strtotime(now))); //输出2020-06-24(注)
echo date('Y-m-d h:i', strtotime( '-1 minutes'));
相关文章推荐
- PHP strtotime函数用法、实现原理和源码分析
- PHP中时间加减函数strtotime用法分析
- PHP教程:strtotime函数用法介绍
- PHP strtotime函数用法、实现原理和源码分析
- php中strtotime()函数的用法
- php&nbsp;strtotime函数和date函数用法
- PHP中strtotime函数用法
- php header 用法 php header 应用 header 函数
- 基于PHP常用函数的用法详解
- PHP错误处理函数set_error_handler()的用法
- php中strstr、strrchr、substr、stristr四个函数用法区别
- PHP字符串替换str_replace()函数4种用法详解
- 解析PHP可变函数的经典用法
- php杂项函数eval的小用法
- PHP的时间函数strtotime
- php在数组开头插入元素函数array_unshift()用法
- PHP正则表达式函数preg_replace用法实例分析
- php 备份/还原函数用法
- PHP中is_callable()函数的用法详解
- php中file_get_contents()函数用法实例