Specifications

you can pass in 0s to the hour, minute, and second parameters. You can, however, leave out
values from the right side of the parameter list. If you leave the parameters blank, they will be
set to the current values. Hence a call such as
$timestamp = mktime();
will return the UNIX time stamp for the current date and time. You could, of course, also get
this by calling
$timestamp = date(ā€œUā€);
You can pass in a 2- or 4-digit year to mktime(). Two-digit values from 0 to 69 will be inter-
preted as the years 2000 to 2069, and values from 70 to 99 will be interpreted as 1970 to 1999.
Using the getdate() Function
Another date-determining function you might find useful is the getdate() function. This func-
tion has the following prototype:
array getdate (int timestamp)
It takes a time stamp as parameter and returns an associative array representing the parts of
that date and time as shown in Table 18.2.
TABLE 18.2 Associative Array Key-Value Pairs from getdate() Function
Key Value
seconds Seconds, numeric
minutes Minutes, numeric
hours Hours, numeric
mday Day of the month, numeric
wday Day of the week, numeric
mon Month, numeric
year Year, numeric
yday Day of the year, numeric
weekday Day of the week, full text format
month Month, full text format
Managing the Date and Time
C
HAPTER 18
18
MANAGING THE
DATE AND TIME
395
23 7842 CH18 3/6/01 3:43 PM Page 395