Wednesday, August 03, 2005

Server time formats for server side includes

To drop a date or time into your web-page, you first need to create an .htaccess file to get the server to parse your html files for server-side includes.

In the .htaccess include the line:

AddType text/x-server-parsed-html html

Then within the html code include a line like:

<!--#config timefmt="%A, %e %B %Y" -->
<!--#echo var="DATE_GMT" -->


This is then replaced by the server time/ date before being served up to the browser.

The possible date/time values are:

Code Purpose of Code
%a Abbreviated weekday name
%A Full weekday name
%b Abbreviated month name
%B Full month name
%c Locale's appropriate date and time representation
%C Default date and time format
%d Day of month - 01 to 31
%D Date as %m/%d/%y
%e Day of month - 1 to 31 (single digits are preceded by a blank)
%h Abbreviated month name (alias for %b)
%H Hour - 00 to 23
%I Hour - 01 to 12
%j Day of year - 001 to 366
%m Month of year - 01 to 12
%M Minute - 00 to 59
%n Insert a newline character (\n)
%p String containing AM or PM
%r Time as %I:%M:%S %p
%R Time as %H:%M
%S Second - 00 to 61
%t Insert a tab character (\t)
%T Time as %H:%M:%S
%U Week number of year (Sunday is the first day of the week) - 00 to 53
%w Day of week - Sunday=0
%W Week number of year (Monday is the first day of the week) - 00 to 53
%x Country-specific date format
%X Country-specific time format
%y Year within century - 00 to 99
%Y Year as CCYY (4 digits)
%Z Time Zone name

0 Comments:

Post a Comment

<< Home

Copyright © NetDominus