htmldate will scan through the documents searching for the string <!--DateStamp--> on a line by itself. If the line exists, all lines from it through the matching <!--/DateStamp--> are removed. This becomes the location for the new date string. If no <!--DateStamp--> line is found, then a new line before either the end of the document or a line containing </BODY> (whichever appears first) is designated as the location for the new date string. Then new lines are entered which look like:htmldate file [file ...]
The date used in the string is the modified time of the file itself. htmldate will not change the file's modified time, so it is safe to run htmldate more than once on the same file without changing the date strings. A copy of the file before changes is saved as the same filename with .bak appended.<!--DateStamp--> <BR><I>Last Modified: Jan 1, 1995 12:00pm</I><BR> <!--/DateStamp-->
The string inserted into the file can be modified by giving a Format argument to <!--DateStamp-->. The default format string is:
An example of specifying an alternate format string and the resulting output from htmldate:<BR><I>Last Modified: %b %d, %Y %I:%M%p</I><BR>
would show up in the document as:<!--DateStamp Format="<BR><I>Last Changed: %n/%D/%y</I></BR>"--> <BR><I>Last Changed: 01/01/95</I><BR> <!--/DateStamp-->
The Format string is preserved between invocations of htmldate. Note that some browsers have difficulties with comment tags with quotes ("") in them; they will assume the comment is complete when the first quote is reached. Browsers known to properly ignore the quotes are Netscape and Mosaic version 2.5.Last Changed: 01/01/95
This can be worked around by specifying the format string on the command
line with the
Escape sequences beginning with % expand into specifiec fields,
in a similar manner to the UNIX date command. The defined
sequences are shown below, with example fields for Sunday January 1, 1995 at
midnight (12am).
Another way to specify a different default date format string is
by setting the environment variable
htmldate -f "<BR><I>Last Changed: %n/%D/%y</I></BR>" file
HTMLDATE
to the
desired format string. Using the -f option overrides
the environment variable.