echo date('Y-m-d H:i:s', strtotime('+1 year'));
// 假設執行日期 2024-12-25 11:00
// ouput: 2025-12-25 11:00
類別 | 範例 | 描述 |
---|---|---|
月份相關 | strtotime('first day of this month') |
本月第一天 |
strtotime('last day of this month') |
本月最後一天 | |
strtotime('first day of last month') |
上個月第一天 | |
strtotime('last day of last month') |
上個月最後一天 | |
strtotime('first day of next month') |
下個月第一天 | |
strtotime('-3 months') |
三個月前的今天 | |
strtotime('+6 months') |
六個月後的今天 | |
strtotime('15 day of this month') |
這個月的第 15 天 | |
年份相關 | strtotime('-1 year') |
去年今天 |
strtotime('+1 year') |
明年今天 | |
strtotime('first day of January next year') |
下一年的第一天 | |
週相關 | strtotime('monday this week') |
本周的第一天(星期一) |
strtotime('sunday this week') |
本周的最後一天(星期日) | |
strtotime('monday last week') |
上周的第一天(星期一) | |
strtotime('sunday last week') |
上周的最後一天(星期日) | |
strtotime('monday next week') |
下周的第一天(星期一) | |
strtotime('sunday next week') |
下周的最後一天(星期日) | |
strtotime('next friday') |
下個週五 | |
strtotime('last friday') |
上個週五 | |
日期相關 | strtotime('today') |
今天 |
strtotime('yesterday') |
昨天 | |
strtotime('tomorrow') |
明天 | |
時間相關 | strtotime('now') |
現在的時間 |
strtotime('-1 hour') |
過去 1 小時 | |
strtotime('+1 hour') |
未來 1 小時 | |
strtotime('-30 minutes') |
過去 30 分鐘 | |
strtotime('+30 minutes') |
未來 30 分鐘 | |
strtotime('-15 seconds') |
過去 15 秒 | |
strtotime('+15 seconds') |
未來 15 秒 | |
特定時間 | strtotime('2024-12-24 15:00') |
特定時間(2024-12-24 15:00) |