End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Date#mjd
d.mjd → integer
ext/date/date_core.c
View on GitHub ↗
static VALUE
d_lite_mjd(VALUE self)
{
get_d1(self);
return f_sub(m_real_local_jd(dat), INT2FIX(2400001));
}
Returns the modified Julian day number. This is a whole number, which is adjusted by the offset as the local time.
Example
DateTime.new(2001,2,3,4,5,6,'+7').mjd #=> 51943 DateTime.new(2001,2,3,4,5,6,'-7').mjd #=> 51943