01时间处理--01 指定年月日.获得当月的第一天和最后一天

短信验证码 2分钟后失效

echo(strtotime("+2 minutes")); 把里面的字符串--转换成时间戳

把date()格式的字符串,转换成时间戳后.才能进行加减处理
$yesterday = '2016-2-16 12:10:10';//把这个字符串--转换成时间戳
指定时间的2分钟后
strtotime($yesterday)+60*2;

上个月最后一天 思路1

date('t',time()); //这个月,最后一天 ,这个月总共有多少天total.代表着最后那一天,用t

date('Y-m-t', strtotime('-1 month'))' //上个月,最后一天

上个月最后一天 思路2

指定年月日.获得当月的第一天和最后一天

function getthemonth($date)
{
$firstday = date('Y-m-01', strtotime($date)); //01指定年月日,获得当月的第一天

$lastday = date('Y-m-d', strtotime("$firstday +1 month -1 day"));//02当月第一天.加一个月--变下个月第一天,再减去一天,

return array($firstday,$lastday);

}

原文地址:https://www.cnblogs.com/bj-tony/p/5318524.html