Specifications

FIGURE 1.3
PHP’s date() function returns a formatted date string.
Calling Functions
Look at the call to date(). This is the general form that function calls take. PHP has an exten-
sive library of functions you can use when developing Web applications. Most of these func-
tions need to have some data passed to them and return some data.
Look at the function call:
date(“H:i, jS F”)
Notice that we are passing a string (text data) to the function inside a pair of parentheses. This
is called the functions argument or parameter. These arguments are the input used by the func-
tion to output some specific results.
The date() Function
The date() function expects the argument you pass it to be a format string, representing the
style of output you would like. Each of the letters in the string represents one part of the date
and time. H is the hour in a twenty-hour hour format, i is the minutes with a leading zero
where required, j is the day of the month without a leading zero, S represents the ordinal suffix
(in this case
“th”), and F is the year in four digit format.
(For a full list of formats supported by
date(), see Chapter 18, Managing the Date and
Time.)
Using PHP
P
ART I
18
03 7842 CH01 3/6/01 3:39 PM Page 18