Understanding PHP’s date and time functions doesn’t seem difficult, but if you don’t already have a grasp of the UNIX timestamp system you won’t get the most out of them. time() is a PHP function that returns the current UNIX timestamp, which is a number. Specifically, it is the number of “Seconds since the UNIX Epoch (January 1 1970 00:00:00 GMT)”. It is independent of locations/timezones so it makes sense to use it as absolute time for computer and IT purposes and it is a number that can be held in 4 bytes, so it’s easy to store.

echo date ("l dS of F Y h:i:s A", time()); //current date and time
echo date ("l dS of F Y h:i:s A", time() - (60 * 60)); //date and time an hour ago
echo date ("l dS of F Y h:i:s A", time() + (60 * 60 * 24 * 90)); //date and time in 90 days

As you can see time() can be useful for doing simple math to get future or previous values. When stored in a database, the UNIX timestamp can be easily searched and modified, and there are many practical uses for it in programming languages, software, and technology.

To sum it up the UNIX timestamp is just the number of seconds since the start of 1970. This means it cannot hold dates that occurred before that time. In theory there are also future dates that it may not hold, because the programming language isn’t expecting numbers that high. This introduction to PHP’s UNIX timestamp capabilities doesn’t cover every aspect but the common uses have been explained.