DATE2MJD Modified Julian day number. MJD = DATE2MJD_v2(datestruct) returns the modified Julian day number of the given date plus a fractional part depending on the day and time of day. Any missing MONTH or DAY will be replaced by ones. Any missing HOUR, MINUTE or SECOND will be replaced by zeros. If no date is specified, the current date and time is used. Gregorian calendar is assumed. Start of the MJD (modified Julian day) count is from 0 at 00:00 UTC 17 November 1858 (Gregorian calendar). corresponding one for format of mjd2date_v2.m
0001 function mjd = date2mjd(date) 0002 %DATE2MJD Modified Julian day number. 0003 % 0004 % MJD = DATE2MJD_v2(datestruct) returns the 0005 % modified Julian day number of the given date plus a fractional part 0006 % depending on the day and time of day. 0007 % 0008 % Any missing MONTH or DAY will be replaced by ones. Any missing HOUR, 0009 % MINUTE or SECOND will be replaced by zeros. 0010 % 0011 % If no date is specified, the current date and time is used. Gregorian 0012 % calendar is assumed. 0013 % 0014 % Start of the MJD (modified Julian day) count is from 0 at 00:00 UTC 17 0015 % November 1858 (Gregorian calendar). 0016 % 0017 % corresponding one for format of mjd2date_v2.m 0018 0019 mjd = date2jd(date.year, date.month, date.day, date.hour, date.minute, date.second) - 2400000.5; 0020 0021 return; 0022