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);

PHP中strtotime()的使用的更多相关文章

  1. PHP中strtotime函数使用方法分享

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

  2. PHP中计算时间段

    在php中 strtotime() 函数将任何英文文本的日期时间描述解析为 Unix 时间戳. 语法strtotime(time,now)  time函数为需要转化为时间戳的时间点  now为返回值的 ...

  3. 关于PHP函数time() date() 和 strtotime() 的时区问题

    最近项目中有个需求, 要记录新注册用户的次日登录情况, 于是写出了如下代码: $create_time = '用户注册时间'; //格式 Y-m-d H:i:s $time = time(); $la ...

  4. Flot Reference flot参考文档

    Consider a call to the plot function:下面是对绘图函数plot的调用: var plot = $.plot(placeholder, data, options) ...

  5. Python开源框架

    info:更多Django信息url:https://www.oschina.net/p/djangodetail: Django 是 Python 编程语言驱动的一个开源模型-视图-控制器(MVC) ...

  6. php中的date和strtotime函数妙用

    php中的两个常用的日期相关函数date和strtotime,相信大家一定不陌生.但我们平时使用都只是基本功能,什么时间戳变日期格式,日期格式变时间戳. 其实这两个函数还有更深的用法: 1.date函 ...

  7. mysql常用内置函数-查询语句中不能使用strtotime()函数!

    来自:http://yushine.iteye.com/blog/775407 FROM_UNIXTIME把 unix时间戳转换为标准时间 unix_timestamp把标准时间转换为 unix时间戳 ...

  8. PHP中的strtotime()对于31日求上个月有问题

    原文出处 <?php $date = "2012-07-31"; $date_unix = strtotime($date); $lastmonth = strtotime( ...

  9. PHP中的strtotime()函数

    参见: http://www.phppan.com/2011/06/php-strtotime/ http://developer.51cto.com/art/201107/275478.htm PH ...

随机推荐

  1. JAVA中commons-collections-3.2.1.jar包是干什么用的?

    类似C++中的Boost库,对Java容器类型和算法的补充

  2. Intellij IDEA 格式化代码

  3. 智能机器人“小昆”的实现(五)MainActivty的实现及项目结束

    好了,一切准备工作都完成了,下面我们就可以真正的编写MainActivity了.在MainActivity中,我们要为ListView设定适配器,并为发送按钮设定点击事件.我们的逻辑就是点击发送按钮, ...

  4. PHP 获取数组随意下标key的上一个prev和下一个next下标值

    PHP 获取数组随意下标key的上一个prev和下一个next下标值 <? php $xoops[1] = '小'; $xoops[2] = '孩'; $xoops[3] = '子'; $xoo ...

  5. UVa 1625 - Color Length(线性DP + 滚动数组)

    链接: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem& ...

  6. BZOJ1009:[HNOI2008]GT考试(AC自动机,矩乘DP)

    Description 阿申准备报名参加GT考试,准考证号为N位数X1X2....Xn(0<=Xi<=9),他不希望准考证号上出现不吉利的数字. 他的不吉利数学A1A2...Am(0< ...

  7. PCB测试点的设计要求

    测试点的设计要求:1.定位孔采用非金属化的定位孔 ,误差小于0.05mm.定位孔周围3mm不能有元件.2.测试点直径不小于0.8mm,测试点之间的间距不小于1.27mm,测试点离元件不小于1.27mm ...

  8. iPhone 横竖屏切换,全屏播放的三种方式

    1. 调用系统自带的强制屏幕旋转不过还得在AppDelegate中重写下面方法 - (UIInterfaceOrientationMask)application:(UIApplication *)a ...

  9. python中 的继承

    1.Python的类可以继承多个类,Java和C#中则只能继承一个类. 2.Python的类如果继承了多个类,那么其寻找方法的方式有两种,分别是:深度优先和广度优先. 当类是经典类时,多继承情况下,会 ...

  10. 剑指Offer_编程题之从尾到头打印链表

    题目描述 输入一个链表,从尾到头打印链表每个节点的值.