PHP: Understanding strtotime
strtotime is a built in PHP function which Parses English textual datetimes into Unix timestamps
Definition and Usage
Unix time in its simplest definition is the number of seconds elapsed since 1 January 1970.
Unix time is also known as Epoch time or POSIX time is a system for describing a point in time. It is the number of seconds that have elapsed since the Unix epoch (1 January 1970 UTC)
In all computers/mobiles/tabs (digital devices) time is calculated only incrementing seconds from 1, Jan 1970.
Since we use gregorian calendar's date and time in our PHP applications, a lot of time we need to get date related event for future and past dates, we convert date to timestamp, get the difference in seconds and convert back in to required format.
$SDATE = '2020-06-01 01:00:00'; - echo strtotime($SDATE); - 1590973200 Sec $EDATE = '2020-06-03 09:00:00'; - echo strtotime($EDATE); - 1591174800 Sec Difference = 1591174800 - 1590973200 = 115200 sec Days = 604800 / = 3 days