Search the site:
(New search engine!!)


This tutorial will cover some more SSI (Server Side Include) ground, in another tutorial I talked about including documents. This time we are going to take a look at the echo directive!

Before I start I should mention that not all servers can handle SSI and that SSI must be enabled on the server. Some servers also demand that you use the .shtml extension (i.e. mypage.shtml). Check with your admin of you can use SSI!

What echo basically does is displaying server information in the page.

A typical use is to display the date, like this:

<!--#echo var="DATE_LOCAL" -->

Just like when we included documents we need to put the SSI statement in a comment tag, or it will display exactly as above.

When used in a page it looks like this: Saturday, 17-Mar-2018 06:12:52 MDT

SSI wouldn't be much fun if we were restricted to only displaying dates, here is a list of variables that you can use in your page:


Authorization method


Size of input posted by the client


MIME type


The current GMT *


Time/date *


The name of the requested document


Document URL


Document modified date *


Number of page hits since the server was brought on line


URL where client came from


The visitor's IP address.


The visitor's domain name. (DNS option must be set on server)


ID of user (hardly ever works)


HTTP method GET or POST


Hostname (like


The port used by httpd (usually 80)


Version of Httpd.


The name and version of the server software.


Total server hits since it was brought on-line

Parameters market with a * can be formatted by using #config.

Here is an example of how #config is used:

<!--#config timefmt=”%y-%m-%d”-->

That would give you the Swedish date format yy/mm/dd, like this 04-12-31. If we change the code and used a capital “Y” we would get 2004-12-31 instead.

To format the date just put the #config statement before the #echo statement, like this:

<!--#config timefmt=”%y-%m-%d”-->
<!--#echo var="DATE_LOCAL" -->

Here is the "live" result using "%y": 18-03-17

SSI offers you a large number of formatting options for dates, here are all the format codes:


Weekday name (short)


Weekday name (full)


Month name (short)


Month name (full)


Locale date and time format.


Default date and time format


Day of month - 01 to 31


Date as %m/%d/%y


Day of month - 1 to 31 (single digits get a space in front of it)


Month name (short) same as %b


Hour 00 to 23


Hour 01 to 12


Day of year 001 to 366


Month of year 01 to 12


Minutes 00 to 59


Insert new line character


AM or PM


Time as %I:%M:%S %p


Time as %H:%M


Seconds 00 to 61


Insert a tab


Time as %H:%M:%S


Week number of year 00 to 53 (Sunday is first day)


Day of week / Sunday=0


Week number of year 00 to 53 (Monday is first day)


Country specific date format


Country specific time format


Year two digits 00 to 99


Year as CCYY (4 digits)


Name of time zone

Do you want to learn how to include one document in another? Check out the Include tutorial!