MJD2date
Contents: Description, Arguments, Usage, Examples, Sub-Functions, Related Functions, Source Supported Under Version: > 1.15
Description Convert input Modified Julian Date to date and time
Arguments and Return Values Parameters: Numbers (scalars) specifying the Julian Date, digits of seconds fraction to display, calendar mode, and print mode. Only the first input is required; the others are optional. The calendar mode and print mode must be passed by reference, with the names cal and print, respectively. Return Value: An array specifying the date and time. The function can also print a string giving the date and time. There may be a slight discrepancy between the two, due to rounding.
Usage Syntax: MJD2date(MJD,digits,cal=n,print=m) The only required input is the Modified Julian Date. The Modified Julian Date is a continuous count of days since midnight UTC at the beginning of November 17, 1858 (in the Gregorian calendar). This input (and all others for this function) must be scalar. The second input (optional) specifies how many digits to display after the decimal in the number of seconds. Defaults to 0 if omitted. If the calendar mode is specified, it must be passed by reference, with the name cal and a value of 0 or 1. (See the examples.) If the calender mode is omitted, the function will guess, based on the input date. Dates before October 15, 1582 (MJD -100840) use the Julian calendar. Dates after that use the Gregorian (modern) calendar. This reflects the first changeover date. However, different countries changed at different times. See http://www.tondering.dk/claus/cal/node3.html. The print mode, print, also must be passed by reference. It sets whether to print the date as a string, in addition to returning it. This defaults to one, so the string will be shown unless print=0. The string will give the date and time if the input is a float or double, or just the date if the input is integer format. This function calculates time on its own but converts the date to JDN and passes the JDN to the function JD2date. It is advisable to enter inputs in double format to ensure accuracy. See intermediate float bug. The returned array has the same organization as an array from the clock function: [year, month, day, hour, minute, second, time zone]. The returned time zone is always zero (UTC). The returned clock system is the same as the input clock system. So if the input Modified Julian dates were UTC, the returned dates/times will be UTC as well, and so on for TT, TAI, etc. The returned array is always integer format. The second input only affects the displayed string. When MJD2date() is entered without any arguments, it prints its description, as shown below.
Examples dv> MJD2date() Convert Modified Julian Date to date and time Scalar inputs only - no arrays! MJD2date(MJD,digits,cal=n,print=m) returns an array specifying the date and time, and can also print a string giving the date and time. There may be a slight discrepancy between the two, due to rounding. Optional second input controls how many digits of second fraction of time will be displayed; 0 if omitted cal (sets calendar mode) must be passed by reference cal=0 for Julian calendar; cal=1 for Gregorian (modern) calendar If cal is omitted, the function will guess, based on the date. Dates before October 15, 1582 (MJD -100840) use Julian calendar Dates after that use Gregorian calendar This reflects the first changeover date. However, different countries changed at different times. See http://www.tondering.dk/claus/cal/node3.html print also must be passed by reference. It sets whether to print the date as a string, in addition to returning it. Prints string if nonzero or omitted; does not print string only if print=0 Return format: [year, month, day, hour, minute, second, 0] The final zero is the time zone offset (0, since this uses UTC). This is the same format used by the function clock. The returned clock system is the same as the input clock system. So if the input Modified Julian dates were UTC, the returned dates/times will be UTC as well, and so on for TT, TAI, etc. This function calculates time on its own but converts the date to JDN and passes the JDN to the function JD2date It is advisable to enter inputs in double format to ensure accuracy. See the DavinciWiki article on the intermediate float bug. S.Marshall 01-22-2010 0 dv> MJD2date(-100840) Friday, October 15, 1582 (Gregorian calendar) 7x1x1 array of int, bsq format [28 bytes] 1582 10 15 0 0 0 0 dv> MJD2date(-100840.5) Thursday, October 4, 1582, 12:00:00 UTC (Julian calendar) 7x1x1 array of int, bsq format [28 bytes] 1582 10 4 12 0 0 0 dv> MJD2date(-100839.5) Friday, October 15, 1582, 12:00:00 UTC (Gregorian calendar) 7x1x1 array of int, bsq format [28 bytes] 1582 10 15 12 0 0 0 |
DavinciWiki Mini-Nav Bar Contents
Contact Developers
All other topics
Recent Library Changes Created On: 11-18-2009 |