Server Side Includes
(SSI)
Time Formats
The last modified time of the current file can also be displayed
using the echo command
<!--#echo var="LAST_MODIFIED" -->
which yields Wednesday, 15-Dec-1999 23:32:50 EST
The last modified time of a specific file may be specified with
<!--#flastmod file="ssi-time.shtml" -->
which would yield Wednesday, 15-Dec-1999 23:32:50 EST
The time format may also be specified with a config statement,
such as
<!--#config timefmt="%A, %B %d, %Y at %r %Z"
-->
which yields
Wednesday, December 15, 1999 at 11:32:50 PM EST
There are many variables you can use to configure how you want a time variable to display. You would display the time in a specific format with two lines--the config line, and an echo line:
<!--#config timefmt="%A, %B %d, %Y at %r %Z" -->
<!--#echo var="LAST_MODIFIED" -->
| timefmt Variable | Yields | Description |
| %% | % | same as % |
| %a | Tue | locale's abbreviated weekday name |
| %A | Tuesday | locale's full weekday name |
| %b | Dec | locale's abbreviated month name |
| %B | December | locale's full month name |
| %c | Tue Dec 14 13:36:25 1999 | locale's appropriate date and time representation Default |
| %C | Tue Dec 14 13:36:25 EST 1999 | locale's date and time representation as produced by date(1) |
| %C | Tue Dec 14 13:36:25 EST 1999 | century number (the year divided by 100 and truncated to an integer as a decimal number [1,99]); single digits are preceded by 0; |
| %d | 14 | day of month [1,31]; single digits are preceded by 0 |
| %D | 12/14/99 | date as %m/%d/%y |
| %e | 14 | day of month [1,31]; single digits are preceded by a space |
| %h | Dec | locale's abbreviated month name |
| %H | 13 | hour (24-hour clock) [0,23]; single digits are preceded by 0 |
| %I | 01 | hour (12-hour clock) [1,12]; single digits are preceded by 0 |
| %j | 348 | day number of year [1,366]; single digits are preceded by 0 |
| %k | 13 | hour (24-hour clock) [0,23]; single digits are preceded by a blank |
| %l | 1 | hour (12-hour clock) [1,12]; single digits are preceded by a blank |
| %m | 12 | month number [1,12]; single digits are preceded by 0 |
| %M | 36 | minute [00,59]; leading zero is permitted but not required |
| %n | insert a newline | |
| %p | PM | locale's equivalent of either a.m. or p.m. |
| %r | 01:36:25 PM | appropriate time representation in 12-hour clock format with %p |
| %R | 13:36 | time as %H:%M |
| %S | 25 | seconds [00,61] |
| %t | insert a tab | |
| %T | 13:36:25 | time as %H:%M:%S |
| %u | 3 | weekday as a decimal number [1,7], with 1 representing Sunday |
| %U | 50 | week number of year as a decimal number [00,53], with Sunday as the first day of week 1 |
| %V | 50 | week number of the year as a decimal number [01,53], with Monday as the first day of the week. If the week containing 1 January has four or more days in the new year, then it is considered week 1; otherwise, it is week 53 of the previous year, and the next week is week 1. |
| %w | 2 | weekday as a decimal number [0,6], with 0 representing Sunday |
| %W | 50 | week number of year as a decimal number [00,53], with Monday as the first day of week 1 |
| %x | 12/14/99 | locale's appropriate date representation |
| %X | 13:36:25 | locale's appropriate time representation |
| %y | 99 | year within century [00,99] |
| %Y | 1999 | year, including the century (for example 1993) |
| %Z | EST | time zone name or abbreviation, or no bytes if no time zone information exists |
Features provided by web.mit.edu
Comments to
cwis-help@mit.edu