The mgiTime Tag

Tag Behavior

Use the mgiTime tag to display the current time in hours and minutes of the server or offset from Greenwich Mean Time. (See also mgiDate).


Tag Syntax

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

<mgiTime html="HTML" format="hour" text="Text" GMTOffset="Hours">

Required Parameters:

  • None.

Optional Parameters:

  • format - The format is the format of the time components. If the format parameter is not specified, the default display of the mgiTime tag is the server's time format. You may include multiple format parameters in one mgiTime tag. Valid formats for the mgiTime tag are:
    • Hour - Displays the numeric hour between 1 and 12.
    • PaddedHour - Displays the numeric hour between 01 and 12.
    • MilitaryHour - Displays the numeric hour between 00 and 23.
    • Minute - Displays the minutes of an hour between 00 and 59.
    • Second - Displays the seconds of a minute between 00 and 59.
    • AmPm - Displays an "am" or "pm" label.
  • gmtOffset - The gmtOffset is the whole or half number of hours the time 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 time 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 mgiTime tag.
  • text - The text is the string of characters that is decoded and displayed relative to the specified time formats. Text in the value of the text parameter is not decoded prior to display. You may include multiple text parameters in one mgiTime tag.


Example Usage and Output

<mgiTime>

If the current server time is 8:45 in the evening, the default mgiTime tag might display as:

8:45 pm

<mgiTime format="paddedHour" text=" " format="amPm">

If the current server time is 6:13 in the morning, the mgiTime tags in this example would display as:

06 am

<mgiTime html="Local Time &lt;b&gt;" format="hour" 
text=":" format="minute" text=" "  
format="amPm" html="&lt;/b&gt;" GMTOffset="-8">

If the current GMT time is 9:15 pm, but you want the local time for Los Angeles, California, then the GMTOffset indicated in this example would display as:

Local Time 1:15 pm


Suggested Usage

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


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


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