Actions With Dates
One way to calculate time is to add or remove the appropriate number of seconds to the time () timestamp. For example, in the case of time () + 60, 60 seconds or 1 minute are added, etc.
01.12.2026 19:45 Current time
01.12.2026 19:46 Current time + 1 minute
01.12.2026 20:45 Current time: +1 hour
02.12.2026 19:45 Current time: +1 day
01.12.2026 19:46 Current time + 1 minute
01.12.2026 20:45 Current time: +1 hour
02.12.2026 19:45 Current time: +1 day
When you reach days, months, and years, the calculation may be a little more complicated, so the calculations could be done with the mktime() function. For example, 23 years before.
mktime(0, 0, 0, 04, 25, 1980-23)
25.04.1957
It is also possible to use English sentences to calculate dates strtotime(), for example:
strtotime("now")
1796147114 "now"
1796162400 "tomorrow"
1795989600 "yesterday"
905374800 "10 September 1998"
1796233514 "+1 day"
1796751914 "+1 week"
1953913514 "+5 years"
1798400733 "+3 week 5 days 2 hours 19 seconds"
1796248800 "next Thursday"
1795471200 "last Tuesday"
1795990680 "6pm 18min yesterday"
1794636000 "8am 17 days ago"
1796162400 "tomorrow"
1795989600 "yesterday"
905374800 "10 September 1998"
1796233514 "+1 day"
1796751914 "+1 week"
1953913514 "+5 years"
1798400733 "+3 week 5 days 2 hours 19 seconds"
1796248800 "next Thursday"
1795471200 "last Tuesday"
1795990680 "6pm 18min yesterday"
1794636000 "8am 17 days ago"