PHP and the UNIX Timestamp
Unix time or POSIX time, is a system for describing points in time. It is widely used not only on Unix like operating systems but in many other computing systems, including the Java programming language. It is an encoding of UTC, and is sufficiently similar to a linear representation of the passage of time that it is frequently mistaken for one.
The Unix timestamp is widely used in PHP. It is the amount of seconds between January 1st 1970 00:00:00 (Unix Epoch) and the present time, to the closest second.
Unix time is one of the things is handled differently on Windows servers compared to Unix servers. On a Linux server the timestamp can be positive or negative, representing before and after the Unix Epoch. Windows servers however produces -1 instead of a negative timestamp, or in PHP 5.1, it produces false.
PHP has many predefined functions that uses the Unix time. They are:
date()
mktime()
strtotime()
time()
date() is likely the most-used date function in PHP, it can generate the current date or a selected timestamp in a huge amount of probabilities. The following are the string determiners.
mktime() has parameters, one for each setting for time: second, minute, hour, month, day & year. The 7th parameter is for day light savings however if this setting is left alone PHP will find out the DS hour itself. mktime() returns a timestamp for the parameters made.
strtotime() converts a string into a timestamp, if it can’t achieve this it’ll return -1 or false.
time() returns the current time to the closest second as a timestamp.
