CFLib.org – Common Function Library Project

GetModifiedJulianDay([TheDate])

Last updated September 04, 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;
}

Search CFLib.org


Latest Additions

Raymond Camden added
QueryDeleteRows
November 04, 2017

Leigh added
nullPad
May 11, 2016

Raymond Camden added
stripHTML
May 10, 2016

Kevin Cotton added
date2ExcelDate
May 05, 2016

Raymond Camden added
CapFirst
April 25, 2016

Created by Raymond Camden / Design by Justin Johnson