The mgiDate Tag

Tag Behavior

Use the mgiDate tag to display the current day, date, month and/or year of the server or offset from GMT (see also mgiTime).


Tag Syntax

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

<mgiDate format="Format" gmtOffset="Hours" 
html="HTML" text="text">

Required Parameters:

  • None.

Optional Parameters:

  • format - The format is the format of the date components. If the format parameter is not specified, the default display of the mgiDate tag is the server's date format. You may include multiple format parameters in one mgiDate tag. Valid formats for the mgiDate tag are:
    • 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).
    • 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.
    • JulianDayNumber - Displays the integer julian day (e.g., 31 Jan 2000 is julian day number 2451574).
    • DayOfYear - Displays a numeric day between 1 and 366.
    • PaddedDayOfYear - Displays a two-digit numeric day between 001 and 366.
    • 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.
    • 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 - The gmtOffset is the whole or half number of hours the date is offset from Greenwich Mean Time preceeded by a positive (+) or negative (-) sign (e.g., "+5" or "-3.5"). Only half hours may be entered. Other tenths of an hour may not be entered. When the GMTOffset parameter is not present, the local date of the server is displayed. A global GMTOffset can be enabled in the region preferences for your domain. If you do not have access to the region preferences for your domain, contact the server administrator. Including a gmtOffset parameter overrides the gmtOffset in the region preferences.
  • html - The html is the HTML code and text that is decoded and displayed relative to the specified date formats. Any HTML in the value of the html parameter should already be encoded (e.g., quotation marks should be entered as "&quot;"). You may include multiple html parameters in one mgiDate tag.
  • text - The text is the string of characters that is decoded and displayed relative to the specified date formats. Text in the value of the text parameter is not decoded prior to display. You may include multiple text parameters in one mgiDate tag.


Example Usage and Output

<mgiDate>

If the current server date is Sunday, the 9th of March 2001, the default mgiDate tag might display like the following. The actual default display of the date depends on the server's date configuration.

Sunday, March 9, 2001

<mgiDate html="Current Month: &lt;font 
color=&quot;#006699&quot;&gt;" format="longMonth" 
text=" " format="longYear" html="&lt;/font&gt;">

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

Current Month: March 2001

<mgiDate format="longWeekday" text=", " format="day" 
text=" " format="longMonth" 
text=", " format="longYear" GMTOffset="-8">

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 might display as:

Saturday, 10 March, 2001


Suggested Usage

  • Server Side Includes
  • Guestbooks
  • Form Processing
  • Database Submissions
  • Emails


[Understanding MGI Menu] [Using MGI Menu] [Referencing MGI Menu]


[MGI Guides Main Menu] [User Guide Main Menu]