The mgiTime Tag

Tag Behavior

The mgiTime tag displays the current time in hours and minutes of the server or offset from GMT.


Tag Syntax

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

<mgiTime format="Time Component" GMTOffset="Hours Offset">

Required Parameters:

  • None.

Optional Parameters:

  • format="Time Component" where "Time Component" is the specific component of the time 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 Hour, Minute, and AmPm.
    • "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 "am" or "pm" label.
    • "Ticks" displays the current tick count of the machine. On the Macintosh, the tick count function returns the number of ticks since computer power-up. Each tick represents 1/60 of a second and is displayed as a whole number.
  • GMTOffset="Hours Offset" where "Hours Offset" is the number of hours the time is offset from Greenwich Mean Time preceded 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 time of the server is displayed.


Example Usage and Output

<mgiTime>

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

8:45 pm

<mgiTime format="PaddedHour"> <mgiTime 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 GMTOffset="-0800">

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:

1:15 pm


Suggested Usage

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


[Return to the Referencing MGI Menu]


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