PHP中strtotime()的使用
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周的星期日的日期
注意:
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()的使用的更多相关文章
- PHP中strtotime函数使用方法分享
在PHP中有个叫做strtotime的函数.strtotime 实现功能:获取某个日期的时间戳,或获取某个时间的时间戳.strtotime 将任何英文文本的日期时间描述解析为Unix时间戳[将系统时间 ...
- PHP中计算时间段
在php中 strtotime() 函数将任何英文文本的日期时间描述解析为 Unix 时间戳. 语法strtotime(time,now) time函数为需要转化为时间戳的时间点 now为返回值的 ...
- 关于PHP函数time() date() 和 strtotime() 的时区问题
最近项目中有个需求, 要记录新注册用户的次日登录情况, 于是写出了如下代码: $create_time = '用户注册时间'; //格式 Y-m-d H:i:s $time = time(); $la ...
- Flot Reference flot参考文档
Consider a call to the plot function:下面是对绘图函数plot的调用: var plot = $.plot(placeholder, data, options) ...
- Python开源框架
info:更多Django信息url:https://www.oschina.net/p/djangodetail: Django 是 Python 编程语言驱动的一个开源模型-视图-控制器(MVC) ...
- php中的date和strtotime函数妙用
php中的两个常用的日期相关函数date和strtotime,相信大家一定不陌生.但我们平时使用都只是基本功能,什么时间戳变日期格式,日期格式变时间戳. 其实这两个函数还有更深的用法: 1.date函 ...
- mysql常用内置函数-查询语句中不能使用strtotime()函数!
来自:http://yushine.iteye.com/blog/775407 FROM_UNIXTIME把 unix时间戳转换为标准时间 unix_timestamp把标准时间转换为 unix时间戳 ...
- PHP中的strtotime()对于31日求上个月有问题
原文出处 <?php $date = "2012-07-31"; $date_unix = strtotime($date); $lastmonth = strtotime( ...
- PHP中的strtotime()函数
参见: http://www.phppan.com/2011/06/php-strtotime/ http://developer.51cto.com/art/201107/275478.htm PH ...
随机推荐
- slf4j-log4j12-1.5.8.jar有什么用
slf4j是hibernate的日志接口,通常我们用log4j.jar来实现hibernate的记录日志功能,slf4j-log4j.jar可以看成是用来把slf4j的接口转换成适合log4j的接口的 ...
- SOJ4478 Easy Problem II(模拟、栈)
Time Limit: 3000 MS Memory Limit: 131072 K Description 在数据结构中 我们学习过 栈 这种数据结构 通过栈 我们可以将1,2,3,...,n转化成 ...
- Dropdownlist控件属性 OnSelectedIndexChanged方法不触发
<asp:DropDownList ID="ddlWJLX" runat="server" OnSelectedIndexChanged="dd ...
- oracle 导出空表问题
select 'alter table '||table_name||' allocate extent;' from user_tables where num_rows=0
- STM32F103 ucLinux开发之四(内核启动后的调试)
Stm32-uclinux启动后的调试 1. 修改__pfn_to_page使得能够启动 根据STM32F103 ucLinux开发之三(内核启动后不正常)的描述,内核无法启动是选择了平板内存模式后 ...
- oracle中的事务
事务 概述:通过sql 对数据库进行操作时,同时执行成功或失败,且数据完整性一致. 链接到oracle的用户(例如plsql或sqlplus)会形成一个session, 此时对数据库的更新操作,不会 ...
- Subclass UICollectionViewFlowLayout,自定义流布局
需求:为实现第一行显示一个,第二行以后显示两个 方案1:用系统自带的流布局,实现的效果是,若第二行只有一个,则系统默认会居中显示,不是左对齐(如下图),不符合项目要求. 方案2:自定义系统的UICol ...
- React最佳实践(1)
React最佳实践不敢妄谈,但最差实践非知乎莫属. 旧版知乎看起来土了点,但体验流畅,起码用起来舒服. 新版知乎看起来UI现代化,技术实现上采用了React,但是可能因为知乎缺钱,请不起高水平的前端工 ...
- C++ Primer学习笔记_1_快速入门
C++快速入门 一 编写简单程序 // main是操作系统唯一显示调用的函数int main() {/**return返回的值是一个状态指示器 0:成功 非0:返回错误给OS*以echo $?命令可以 ...
- HDU 2065 "红色病毒"问题(生成函数)
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission( ...