PHP获取前一天,前一个月,前半年,前一年的时间戳

 

// 获取前一秒
strtotime("-1 seconds");
 
// 获取前一分钟
strtotime("-1 minute");
 
// 获取前一小时
strtotime("-1 hour");
 
// 获取前一天
strtotime("-1 day");
 
// 获取前一周
strtotime("-1 week");
 
// 获取前一个月
strtotime("-1 month");
 
// 获取前一年
strtotime("-1 year");
 
// 获取下周四
strtotime("next Thursday");
 
// 获取上周一
strtotime("last Monday");
 
// 还可以组合使用
strtotime("+1 week 2 days 4 hours 2 seconds");

 

posted @ 2022-10-02 07:50  幽篁晓筑  阅读(949)  评论(0编辑  收藏  举报