PHP Date and Time Functions

PHP offers a few really nice functions to manipulate dates and times. With the functions built into PHP, you can easily pull individual parts of a date or time and use it or format it just about any way you want.

strtotime()

To start, you should really familiarize yourself with PHP’s strtotime() function. The strtotime() function takes a standard date (and optional time) and converts it into a Unix timestamp. Because the strtotime() function returns boolean false if it doesn’t recognize the input as a valid date/time, you can also use it to check the validity of a date.