Generating a Timestamp
Date and time is generally represented as a Unix timestamp: the number of seconds since 1 January 1970 00:00:00 Greenwich Mean Time. Most systems represent a timestamp using a signed 32-bit integer, allowing a range of dates from December 13, 1901 through January 19, 2038. While timestamps are convenient to work with in scripts, care must be taken when manipulating timestamps to avoid integer overflow errors. A common source of errors is to compare two timestamps in which the date range is greater than the largest positive integer-a range just over 68 years for a signed 32-bit integer.
PHP provides several functions that generate a Unix timestamp. The simplest:
integer time( )
returns the timestamp for the current date and time, as shown in this fragment:
// prints the current timestamp: e.g., 1008553254 echo time( );