Skip to main content

datetime_to_mjd

Function datetime_to_mjd 

Source
pub fn datetime_to_mjd(dt: PrimitiveDateTime) -> f64
Expand description

Modified Julian Date of a timezone-naive instant (taken as UTC). Inverse of mjd_to_datetime.

use skymath::datetime_to_mjd;
use time::macros::datetime;

// J2000.0 = MJD 51544.5.
assert_eq!(datetime_to_mjd(datetime!(2000-01-01 12:00)), 51_544.5);