php如何输出6天前/1个月后的时间?

17-10-01 12:24 字数 2 阅读 2543

rt

0人点赞>
关注 收藏 改进 举报
1 条评论
排序方式 时间 投票
草芥
// 6分钟前        
date('Y-m-d H:i:s',strtotime('-6 mins'))        
// 3小时前        
date('Y-m-d H:i:s',strtotime('-3 hours'))        
// 3天前        
date('Y-m-d H:i:s',strtotime('-3 days'))        
// 3个月前        
date('Y-m-d H:i:s',strtotime('-3 months'))        
// 1个月后        
date('Y-m-d H:i:s',strtotime('+1 month'))        
// 7天后        
date('Y-m-d H:i:s',strtotime('+7 days'))        
// 其实是有规律可寻的,xxx前 就用-负号加上xxx,如大于1xxx 加s【单位英文的复数形式】        
// 如果是xxx后,就用+加上xxx >1 同样加s    
请登录后发表评论