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.04.2026 17:56 Current time
07.04.2026 17:57 Current time + 1 minute
07.04.2026 18:56 Current time: +1 hour
08.04.2026 17: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")

1775573788 "now"
1775595600 "tomorrow"
1775422800 "yesterday"
905374800 "10 September 1998"
1775660188 "+1 day"
1776178588 "+1 week"
1933340188 "+5 years"
1777827407 "+3 week 5 days 2 hours 19 seconds"
1775682000 "next Thursday"
1774904400 "last Tuesday"
1775423880 "6pm 18min yesterday"
1774072800 "8am 17 days ago"

Relative Formats