The mgiJulianDay Tag

Tag Behavior

Use the mgiJulianDay tag to convert a date and time to a decimal Julian day or to convert a decimal Julian day to a specified date and/or time format. Julian dates can be used to sort and order date values.


Tag Syntax

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

<mgiJulianDay month="Month" day="Day" year="Year"
hour="Hour" minute="Minute" second="Second" dateOnly="Yes/No"
relativeStep="Integer" relativeUnits="Units">

or

<mgiJulianDay julianDay="Julian Day" format="Format" 
html="HTML" text="text">

Required Parameters:

  • None.

Optional Parameters:

  • month - The month is the months to convert to a julian date. The month format may be the full month name, the three letter abbreviation of the month or the numeric month value.
  • day - The day is the day of the month to convert to a julian date.
  • year - The year is the year to convert to a julian date
  • hour - The hour is the military hour to convert to a julian date
  • minute - The minute is the minutes to convert to a julian date.
  • second - The second is the seconds to convert to a julian date.
  • ampm - Adjusts the specified hour based on an "am" or "pm" value. If the parameter value is "am", the hour is converted to a julian date as entered. If the parameter value is "pm", 12 hours are added during the julian date conversion. The "hour" parameter is required and must contain a value between "0" and "11". The default value is "am".
  • dateOnly - The dateOnly parameter specifies if only the date component of the julian day number is displayed or if the date and time components of the julian day number are displayed. If the dateOnly parameter value is "Yes", then only the date component of the julian day number is displayed. If the dateOnly parameter value is "No", then the date and time components of the julian day number are displayed. The default value is "no".
  • relativeStep - The relativeStep is the number of relative units to increase the julian day calculation. The default relative step is "0" (the current time.) If a relative step greater than 0 is specified, the relativeUnits parameter is required.
  • relativeUnits - The relativeUnits is the type of increase to make in the julian day. Valid relative units are "seconds", "minutes", "hours", and "days".
  • julianDay - The julianDay is the julian day number to convert to a standard date format.
  • format - The format is the format of the date and time that is converted from a julian day number. You may include multiple format parameters in one mgiJulianDay tag. Valid formats 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.
    • DaySuffix - Displays the appropriate suffix for each numerical day (i.e., "st", "nd", "rd", or "th").
    • 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.
    • Date - Displays the server's standard date format.
    • 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.
    • Time - Displays the server's standard time format.
  • 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 mgiJulianDay 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 mgiJulianDay tag.


Example Usage and Output

<mgiJulianDay>

In this example, the current julian day with the time fraction is displayed: 2451845.96118056

<mgiJulianDay dateOnly="yes">

In this example, the current julian day without the time fraction is displayed: 2451845

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

In this example, the julian day of December 25, 1999 is displayed without the time fraction: 2451537

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

In this example, the julian day of December 25, 1999 at 5:34:58 PM is displayed: 2451537.73261574

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

In this example, the month and year of julian day 2455343 are displayed: May 2010

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

In this example, the hour of julian date 2455343.33439894789 is displayed: 08

<mgiJulianDay relativeStep="27" relativeUnits="minutes">

In this example, the julian day 27 minutes from the time the mgiJulianDay tag was processed is displayed: 2451845.97993056

<mgiJulianDay relativeStep="44" relativeUnits="hours">

In this example, the jullian day 44 hours from the time the mgiJulianDay tag was processed is displayed: 2451847.79451389


Suggested Usage

  • Creating Julian Day Values for Embedding
  • Sorting by Dates


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


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