Home : Products : Gossamer Forum : Discussion :

Products: Gossamer Forum: Discussion: Re: [unixman] Hmm, it seems no one is reading here...: Edit Log

Here is the list of edits for this post
Re: [unixman] Hmm, it seems no one is reading here...

In the Language Variables for each template set, you will find several related variables in the "DATE" section.

DATE_DAY_1 through DATE_DAY_7 controls the day of the week printed out for a "long" day (more on this in a second). For example, "Monday".

DATE_DAY_SHORT_1 through DATE_DAY_SHORT_7 are the days abbreviated (ie. "Mon").

DATE_MONTH_1 through DATE_MONTH_12 show the month ("January") and the _SHORT versions again store the abbreviated form ("Jan").

The actual display of the date is controlled by the DATE_FORMAT variable. This can look a little confusing, so bear with me. (This is actually copied and pasted from the GT::Date documentation, which you can get to by going to Help -> Table of Contents -> GT Module documentation -> GT Date -> "Setting date format").


You can use date_set_format to change the format. You pass in a format string. It is made up of:

%yyyy% four digit year as in 1999
%yy% two digit year as in 99
%y% two digit year without leading 0
%mmmm% long month name as in January
%mmm% short month name as in Jan
%mm% numerical month name as in 01
%m% numerical month name without leading 0 as in 1
%dddd% long day name as in Sunday
%ddd% short day name as in Sun
%dd% numerical date
%d% numerical date without leading 0
%HH% two digit hour, 24 hour time
%H% one or two digit hour, 24 hour time
%hh% two digit hour, 12 hour time. 0 becomes 12.
%h% one or two digit hour, 12 hour time. 0 becomes 12.
%MM% two digit minute
%M% one or two digit minute (when would someone ever WANT this?)
%ss% two digit second
%s% one ot two digit second (when would someone ever WANT this?)
%tt% AM or PM (use with 12 hour time) %o% + or - GMT offset
Common formats include:

%yyyy%-%mm%-%dd% 1999-12-25
%dd%-%mmm%-%yyyy% 12-Dec-1999
%ddd% %mmm% %dd% %yyyy% Sat Dec 12 1999
%ddd% %mmm% %dd% %yyyy% Sat Dec 12 1999

For example, if you wanted the date to show up as:

2002 April 17 18:20

You would use:

%yyyy% %mmmm% %dd% %HH%:%MM%

(Watch out - it's easy to accidentally use %mm% for the minutes instead of %MM%).

Jason Rhinelander
Gossamer Threads

Last edited by:

Jagerman: May 5, 2002, 1:01 PM

Edit Log: