DekGenius.com
[ Team LiB ] Previous Section Next Section

Recipe 8.9 Displaying Last Modified Date

Problem

You want your web page to indicate when it was last modified but not have to update the date every time.

Solution

Use SSI processing by putting a line in the HTML file for which you want the information displayed:

<--#config timefmt="%B %e, %Y" -->
This document was last modified on <!--#echo var="LAST_MODIFIED" -->

Discussion

The config SSI directive allows you to configure a few settings governing SSI output formats. In this case, we're using it to configure the format in which date/time information is output. The default format for date output is 04-Dec-2037 19:58:15 EST which is not the most user-friendly message. The recipe provided changes this to the slightly more readable format December 4, 2002. If you want another output format, the timefmt attribute can take any argument accepted by the C strftime(3) function.

See Also

    [ Team LiB ] Previous Section Next Section