Functions

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.

07.12.2025 9:56 Current time
07.12.2025 9:57 Current time + 1 minute
07.12.2025 10:56 Current time: +1 hour
08.12.2025 9:56 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")

1765094195 "now"
1765144800 "tomorrow"
1764972000 "yesterday"
905374800 "10 September 1998"
1765180595 "+1 day"
1765698995 "+1 week"
1922860595 "+5 years"
1767347814 "+3 week 5 days 2 hours 19 seconds"
1765404000 "next Thursday"
1764626400 "last Tuesday"
1764973080 "6pm 18min yesterday"
1763618400 "8am 17 days ago"

Relative Formats