Functions for conversion of time values between various forms. The forms used are
yyyy-mm-ddThh:mm:ss.s
, where the T
is a literal character (a space character may be used instead).
Based on UTC.
Therefore midday on the 25th of October 2004 is
2004-10-25T12:00:00
in ISO 8601 format,
53303.5 as an MJD value,
2004.81588 as a Julian Epoch and
2004.81726 as a Besselian Epoch.
Currently this implementation cannot be relied upon to better than a millisecond.
isoToMjd( isoDate )
isoDate
argument is
yyyy-mm-ddThh:mm:ss.s
, though some deviations
from this form are permitted:
T
' which separates date from time
can be replaced by a space
Z
' (which indicates UTC) may be appended
to the time
1994-12-21T14:18:23.2
",
"1968-01-14
", and
"2112-05-25 16:45Z
".
isoDate
(String): date in ISO 8601 format
isoDate
isoToMjd("2004-10-25T18:00:00") = 53303.75
isoToMjd("1970-01-01") = 40587.0
dateToMjd( year, month, day, hour, min, sec )
year
(integer): year AD
month
(integer): index of month; January is 1, December is 12
day
(integer): day of month (the first day is 1)
hour
(integer): hour (0-23)
min
(integer): minute (0-59)
sec
(floating point): second (0<=sec<60)
dateToMjd(1999, 12, 31, 23, 59, 59.) = 51543.99998
dateToMjd( year, month, day )
year
(integer): year AD
month
(integer): index of month; January is 1, December is 12
day
(integer): day of month (the first day is 1)
dateToMjd(1999, 12, 31) = 51543.0
decYearToMjd( decYear )
decYear
(floating point): decimal year
decYearToMjd(2000.0) = 51544.0
mjdToIso( mjd )
yyyy-mm-ddThh:mm:ss
.
mjd
(floating point): modified Julian date
mjd
mjdToIso(53551.72917) = "2005-06-30T17:30:00"
mjdToDate( mjd )
yyyy-mm-dd
.
mjd
(floating point): modified Julian date
mjd
mjdToDate(53551.72917) = "2005-06-30"
mjdToTime( mjd )
hh:mm:ss
.
mjd
(floating point): modified Julian date
mjd
mjdToTime(53551.72917) = "17:30:00"
mjdToDecYear( mjd )
mjd
(floating point): modified Julian Date
mjdToDecYear(0.0) = 1858.87671
formatMjd( mjd, format )
java.text.SimpleDateFormat
class.
The default output corresponds to the string
"yyyy-MM-dd'T'HH:mm:ss
"
Note that the output from certain formatting characters
(such as MMM
for month, EEE
for day of week)
is dependent on your locale (system language settings).
The output time zone however always corresponds to UTC.
mjd
(floating point): modified Julian date
format
(String): formatting patttern
mjd
formatMjd(50000.3, "EEE dd, MMM, yy")
= "Tue 10 Oct, 95"
formatMjd(50000.1234, "'time 'H:mm:ss.SSS")
= "time 2:57:41.760"
mjdToJulian( mjd )
mjd
(floating point): modified Julian date
mjdToJulian(0.0) = 1858.87885
julianToMjd( julianEpoch )
julianEpoch
(floating point): Julian epoch
julianToMjd(2000.0) = 51544.5
mjdToBesselian( mjd )
mjd
(floating point): modified Julian date
mjdToBesselian(0.0) = 1858.87711
besselianToMjd( besselianEpoch )
besselianEpoch
(floating point): Besselian epoch
besselianToMjd(1950.0) = 33281.92346
unixMillisToMjd( unixMillis )
unixMillis
(long integer): milliseconds since the Unix epoch
mjdToUnixMillis( mjd )
mjd
(floating point): modified Julian date