The mgiJulianDay Tag

Tag Behavior

The mgiJulianDay tag converts a date and time to a decimal Julian Day or converts a decimal Julian Day to a specified date and/or time format. Julian dates can be used to sort and order date values. (To get an integer of the current Julian Day, use the mgiDate tag and JulianDay parameter).


Tag Syntax

The mgiJulianDay tag has no required parameters and 8 optional parameter. The tag form is:

<mgiJulianDay month="Month" day="numericDay" year="longYear"
hour="militaryHour" minute="numericMinute" second="numericSecond"
julianDay="decimalJulianDay" format="format">

Required Parameters:

  • None.

Optional Parameters (Converting Standard Date to Julian Date):

  • month="Month" where "Month" is the 2-digit month, long month name or 3-letter abbreviated month name to convert to a Julian Date. The default month is the current month.
  • day="numericDay" where "numericDay" is the 2-digit day to convert to a Julian Date. The default day is the current day of the month.
  • year="longYear" where "longYear" is the 4-digit year to convert to a Julian Date. The default year is the current year.
  • hour="militaryHour" where "militaryHour" is the 2-digit military hour to convert to a Julian Date. The default hour is 00.
  • minute="numericMinute" where "numericMinute" is the 2-digit minute to convert to a Julian Date. The default minute is 00.
  • second="numericSecond" where "numericSecond" is the 2-digit second to convert to a Julian Date. The default second is 00.

Required Parameters (Converting Julian Date to Standard Date):

  • julianDay="decimalJulianDay" where "decimalJulianDay" is the decimal Julian Date to convert to a standard date. If a format parameter is not included, the converted date and time are displayed in the format longMonth Day, longYear militaryTime (e.g., January 31, 1999 1735).

Optional Parameters (Converting Julian Date to Standard Date):

  • format="format" where "format" is the type and display of information from the list below when a Julian Date is converted to a standard date. Only one format may be used per mgiJulianDay tag. To display multiple formats, use multiple mgiJulianDay tag. If you include a format, the julianDay parameter is required.
    • "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.
    • "LongWeekDay" displays the day of the week from Sunday to Saturday.
    • "ShortWeekDay" displays the abbreviated day of the week from Sun to Sat.
    • "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.
    • "Date" displays the LongMonth Day, LongYear.
    • "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.
    • "Time" displays the PaddedHour:Minute:Second


Example Usage and Output

Display the current julian day with the time fraction:

<mgiJulianDay>

Display the julian day of last Christmas:

<mgiJulianDay month="12" day="25" year="1999">

Display the julian day of last Christmas at 5:34:58 pm

<mgiJulianDay month="12" day="25" year="1999" hour="17" minute="34" 
second="58">

Display the month and year of the julian day 2455343:

<mgiJulianDay julianDay="2455343" format="longMonth"> <mgiJulianDay 
julianDay="2455343" format="longYear">

Display the hour of the julian day 2455343.33439894789:

<mgiJulianDay julianDay="2455343.33439894789" format="militaryHour">


Suggested Usage

  • Sorting by Dates


[Return to the Referencing MGI Menu]


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