CFLib.org – Common Function Library Project

GetModifiedJulianDay([TheDate])

Last updated September 4, 2001

author

Beau A.C. Harbin

Version: 1 | Requires: CF5 | Library: DateLib

Description:
Calculates the modified Julian Day for any date in the Gregorian calendar. Sometimes a modified Julian day number (MJD) is used which is 2,400,000.5 less than the Julian day number. This brings the numbers into a more manageable numeric range and makes the day numbers change at midnight UTC rather than noon. MJD 0 thus started on 17 Nov 1858 (Gregorian) at 00:00:00 UTC.

Return Values:
Returns a numeric value.

Example:

<CFOUTPUT>Today's modified Julian Day is: #GetModifiedJulianDay()#</CFOUTPUT>

Parameters:

Name Description Required
TheDate Date you want to return the modified Julian day for. No

Full UDF Source:

/**
 * Calculates the modified Julian Day for any date in the Gregorian calendar.
 * This function requires the GetJulianDay() function available from the DateLib library.  Minor edits by Rob Brooks-Bilson (rbils@amkor.com).
 * 
 * @param TheDate 	 Date you want to return the modified Julian day for. 
 * @return Returns a numeric value. 
 * @author Beau A.C. Harbin (bharbin@figleaf.com) 
 * @version 1.0, September 4, 2001 
 */
function GetModifiedJulianDay()
{
  var date = Now();
  var ModifiedJulianDay = 0;
  if(ArrayLen(Arguments)) 
    date = Arguments[1];	
  ModDate = GetJulianDay(date);
  ModifiedJulianDay = ModDate - 2400000.5;
  return ModifiedJulianDay;
}
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Kevin Cotton added
date2ExcelDate
May 5, 2016

Raymond Camden added
CapFirst
April 25, 2016

Chris Wigginton added
loremIpsum
January 18, 2016

Gary Stanton added
calculateArrival...
November 19, 2015

Sebastiaan Naafs - van Dijk added
getDaysInQuarter
November 13, 2015

Created by Raymond Camden / Design by Justin Johnson