strtotime是一个非常强大的函数。

传入的参数,详见官网的介绍

本月最后一个周日

echo date('Y-m-d',strtotime('last sunday of this month'));

下个月第三个周日

echo date('Y-m-d',strtotime('third sunday of next month'));

下个月的最后一天

echo date('Y-m-d',strtotime('last day of next month'));

第28周的星期日的日期

date('Y-m-d', strtotime('2014-W28-7'));

注意:

1. 获取本年的最后一天 strtotime('last day of this year') 是不起作用的,因为 last day of 只对月起作用。正确的方法date('Y-m-d',strToTime('1/1 next year -1 day'));

另附:

// the first day in this week,it's Monday
$thisMonday = date('Y-m-d', time() - 86400*date('w') + 86400);
// the last day in this week,it's Friday
$thisFriday   = date('Y-m-d', time() - 86400*date('w') + 86400*5);

转载于:https://www.cnblogs.com/mafeifan/p/3552320.html

PHP中strtotime()的使用相关推荐

  1. php中strtotime(date,js模仿php中strtotime()与date()函数实现方法

    本文实例讲述了js模仿php中strtotime()与date()函数实现方法.分享给大家供大家参考.具体如下: 在js中没有像php中strtotime()与date()函数,可直接转换时间戳,下面 ...

  2. php中strtotime的意思,php中strtotime函数用法详解

    本文实例讲述了php中strtotime函数用法.分享给大家供大家参考.具体如下: strtotime(字符串$时间[,诠释$现在])int strtotime(string $time [,int ...

  3. php中strtotime的意思,PHP中strtotime

    关于 PHP中strtotime的搜索结果 问题 对1970年之前的日期使用strtotime?mysql 我在mysql中有一个文本列,它以yyyy-mm-dd格式存储日期值.现在,在我的php页面 ...

  4. java strtotime_js模仿php中strtotime()与date()函数实现方法

    本文实例讲述了js模仿php中strtotime()与date()函数实现方法.分享给大家供大家参考.具体如下: 在js中没有像php中strtotime()与date()函数,可直接转换时间戳,下面 ...

  5. php中strtotime函数,PHP中strtotime函数用法

    strtotime函数在php中是可以把日志转换成时间戳,他可以方便的让我们对日期时间分秒的计算,下面我来给各位介绍时strtotime函数用法,有需要的同学可参考. 1.获取当前的时间的时间戳! a ...

  6. php strtotime坑,php中strtotime函数的坑

    问题: //根据出生年月 计算年龄 $birthday = '0000-00-00'; $age = strtotime($birthday); if($age === false){ return ...

  7. PHP中strtotime函数有范围吗,PHP中使用strtotime函数注意事项

    strtotime函数在是大家常用的一个时间日期转换成单位S的一个函数了,但是这个函数有一个细节大家可能没有注意到,就是 使用的时候需要考虑 有31天和 2月份的情况,所以,如果没有考虑这个特殊的情况 ...

  8. php strtotime,php中strtotime什么意思

    strtotime PHP内置时间函数 (PHP 4, PHP 5) strtotime()可以用英语的自然语言创建某个时刻的时间戳 函数语法:int strtotime(string $time[, ...

  9. PHP中strtotime函数的坑

    坑的生命周期 怎么入的坑 strtotime的介绍 实例 定义和用法 语法 技术细节 找出逻辑规律 怎么从坑里爬出来呢? 那耄耋老人,怎么出坑呢? 参考链接 怎么入的坑 我在使用strtotime 获 ...

  10. php中strtotime参数,PHP中strtotime函数使用方法

    在PHP中有个叫做strtotime的函数.strtotime 实现功能:获取某个日期的时间戳,或获取某个时间的时间戳.strtotime 将任何英文文本的日期时间描述解析为Unix时间戳[将系统时间 ...

最新文章

  1. 使用hello word写小说
  2. hadoop开发必读:认识Context类的作用
  3. CryptoZombies学习笔记——Lesson4
  4. html基础总结4-实现点击图片弹出放大图片--不用插件
  5. java word 在线编辑图片_java开发实现word在线编辑及流转
  6. (巴什博弈 sg函数入门1) Brave Game -- hdu -- 1846
  7. php流程控制语句,php学习之道:php 流程控制语句
  8. 搭建springboot环境
  9. 感悟:web前端工程师该如何定位
  10. 谷歌浏览器安卓_用谷歌服务更安全了,安卓手机可充当物理安全密匙
  11. 一手云端,一手终端:比特大陆发布两款AI芯片,大步迈进AI领域
  12. 阿里云,CentOS下yum安装mysql,jdk,tomcat
  13. 自带内网穿透的文件同步工具Syncthing介绍
  14. 计算机远程操作之后怎么保护,电脑远程控制怎么操作 两种方法介绍
  15. 信用卡评分模型(R语言)
  16. 7.交易开拓者-公式进阶(一)
  17. 云脉文档管理系统,工作中的实用工具
  18. java文字水印换行_Java实现图片水印文字换行、平铺、旋转效果-Go语言中文社区...
  19. typora 分割线_最全Typora语法大全(含详细数学表达式及流程图)
  20. 电脑d盘和e盘不见了怎么恢复?

热门文章

  1. linux ubuntu/centos git 客户端编译安装升级
  2. Ubuntu 15.04 Gogs(git 版本库) 二进制安装
  3. Postman API 开发的协作平台
  4. RequestContextHolder 获取 ServletRequest 和 ServletResponse,Spring MVC ModelAndView 数据响应 Response
  5. 阶段5 3.微服务项目【学成在线】_day03 CMS页面管理开发_18-异常处理-不可预知异常处理...
  6. 小D课堂-SpringBoot 2.x微信支付在线教育网站项目实战_3-2.使用Mybatis注解开发视频列表增删改查...
  7. 阶段3 1.Mybatis_06.使用Mybatis完成DAO层的开发_1 Mybatis中编写dao实现类的使用方式-查询列表...
  8. QT creator 编辑器快捷键
  9. python3 + pycharm+requests+HTMLTestRunner生成不了测试报告html
  10. 光在参与介质中的传播及辐射传递方程