14.1. Time and Date

All the time functions work off the UNIX epoch, which is January 1, 1970. Dates are expressed as seconds since the epoch. This makes it easy to refer to dates with integers. When a function calls for seconds since the epoch, I've referred to it as a timestamp.

Windows accepts timestamps from zero to the largest 32-bit integer, which corresponds to January 19, 2038. UNIX allows for negative timestamps, which stretch back to December 13, 1901.

boolean checkdate(integer month, integer day, integer year)

The checkdate function (Listing 14.1) returns TRUE if a date is valid, and FALSE otherwise. A day is considered valid if the year is between 0 and 32767, the month is between 1 and 12, and the day is within the allowable days ...

Get Core PHP Programming, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.