260 Chapter 13 – Server Side Includes
Time Formats for SSI Output
Web Design in a Nutshell, eMatter Edition
HTTP_REFERER
The URL of the document the client points to before accessing the CGI
program
HTTP_USER_AGENT
The browser the client is using to issue the request
REMOTE_ADDR
The remote IP address from which the user is making the request
REMOTE_HOST
The remote hostname from which the user is making the request (can be
useful for detecting top level domain suffixes such as.com,.edu, etc.)
Time Formats for SSI Output
SSI provides a rich set of date and time formats that can be used with thetimefmt
attribute of theconfigcommand. To format the date, insert the code for the
format, separated by commas as you intend it to display in the inserted text:
<!--#config timefmt="%A, %B %e, %Y" -->
Good morning! It is now <!--#echo var="DATE_LOCAL" -->
would result in the date and time displayed in this manner:
Good morning! It is now Friday, July 3, 1998
As you can see,%Aspecifies the full day name,%Bspecifies the full month name,
etc. Commas placed within the list will display in the inserted date and time.
Table 13-1 provides the standard SSI time format codes and their meanings.
Table 13-1: SSI Time Formats
Status Code Meaning Example
%a Day of the week abbreviation Sun
%A Day of the week Sunday
%b Month name abbreviation (also%h) Jan
%B Month name January
%d Date 01
%D Date as"%m/%d/%y" 07/19/65
%e Date 1 (not 01)
%H 24-hour clock hour 13
%I 12-hour clock hour 01
%j Decimal day of the year 148
%m Month number 11
%M Minutes 08
%p AM | PM AM
%r Time as "%I:%M:%S %p" 01:50:40 AM
%S Seconds 09
%T 24-hour time as "$H:%M:%S" 20:15:30