The mgiDate Tag

Tag Behavior

The mgiDate tag displays the current day, date, month and year of the server or offset from GMT.


Tag Syntax

The mgiDate tag has no required parameters and two optional parameters. The tag form is:

<mgiDate format="Date Component" GMTOffset="Hours Offset">

Required Parameters:

  • None.

Optional Parameters:

  • format="Date Component" where "Date Component" is the specific component of the date from the list below that you wish to display. If the format parameter is not specified, the default behavior of the mgiCounter tag is to display the Short Week Day, Padded Day, Long Month, and Long Year.
    • "LongWeekDay" displays the full week day without abbreviation (e.g. Tuesday)
    • "ShortWeekDay" displays the three-letter abbreviation of the week day (e.g. Sat)
    • "NumericWeekday" displays a numeric week day between Sunday (1) and Saturday (7).
    • "LongMonth" displays the full month without abbreviation (e.g.,November).
    • "ShortMonth" displays the three-letter abbreviation of the month (e.g. Jun).
    • "NumericMonth" displays a numeric month between January (1) and December (12).
    • "PaddedNumericMonth" displays a two-digit numeric month between January (01) and December (12).
    • "WeekOfYear" displays the numeric week of the year from 1 to 52.
    • "PaddedWeekOfYear" displays the two-digit numeric week of the year from 01 to 52.
    • "Day" displays a numeric day of the month as a number between 1 and 31.
    • "PaddedDay" displays a two-digit numeric day of the month as a number between 01 and 31.
    • "DayOfYear" displays a numeric day between 1 and 366
    • "JulianDay" displays the integer julian day (e.g., 31 Jan 2000 is julian day number 2451574)
    • "PaddedDayOfYear" displays a two-digit numeric day between 001 and 366.
    • "LongYear" displays the four-digit year as a number between 1000 and 9999.
    • "ShortYear" displays the two-digit year as a number between 00 and 99.
  • GMTOffset="Hours Offset" where "Hours Offset" is the number of hours the date is offset from Greenwich Mean Time preceeded by a positive (+) or negative (-) sign (e.g., GMTOffset="+0500"). The GMTOffset hours should be written as four-digits. When the GMTOffset parameter is not present, the local date of the server is displayed.


Example Usage and Output

<mgiDate>

If the current server date is Sunday, the 9th of March 2001, the default mgiDate tag would display as:

Sun, 9 March, 2001

<mgiDate format="LongMonth"> <mgiDate format="LongYear">

If the current server date is Sunday, the 9th of March 2001, the mgiDate tags in this example would display as:

March 2001

<mgiDate GMTOffset="-0800">

If the current GMT date is 5 am Sunday, the 11th of March 2001, but you want the local date for Los Angeles, California, then the GMTOffset indicated in this example would display as:

Sat, 10 March, 2001


Suggested Usage

  • Server Side Includes
  • Guestbook
  • Form Processing
  • Database Submissions


[Return to the Referencing MGI Menu]


[User Guide Main Menu] [Understanding MGI Menu] [Using MGI Menu] [Referencing MGI Menu]