htmldate Manual

To assist with the maintenance of date stamps for HTML documents, htmldate is available. Its usage is:
htmldate file [file ...]
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:
<BR><I>Last Modified: Jan 1, 1995 12:00pm</I><BR>
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.

The string inserted into the file can be modified by giving a Format argument to <!--DateStamp-->. The default format string is:

<BR><I>Last Modified: %b %d, %Y %I:%M%p</I><BR>
An example of specifying an alternate format string and the resulting output from htmldate:
<!--DateStamp Format="<BR><I>Last Changed: %n/%D/%y</I></BR>"-->
<BR><I>Last Changed: 01/01/95</I><BR>
would show up in the document as:
Last Changed: 01/01/95
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.

This can be worked around by specifying the format string on the command line with the -f flag:

htmldate -f "<BR><I>Last Changed: %n/%D/%y</I></BR>" file
Another way to specify a different default date format string is by setting the environment variable HTMLDATE to the desired format string. Using the -f option overrides the environment variable.

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).

Short weekday name ("Sun")
Full weekday name ("Sunday")
Short month name ("Jan")
Full month name ("January")
Day of month between 1 and 31 ("1")
Day of month between 01 and 31 ("01")
Hour as decimal between 00 and 23 ("00")
Hour as decimal between 1 and 12 ("12")
Number of month between 1 and 12 ("1")
Minute between 00 and 59 ("00")
Number of month between 01 and 12 ("01")
Literal double quote (""")
Second between 00 and 59 ("00")
Lowercase am or pm ("am")
Uppercase AM or PM ("AM")
Year without century ("95")
Year with century ("1995")
Literal % ("%")