Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Serial date number since "Jan 1, 0000": is this -1 BC or +1 CE?

I was working on dates in Matlab and Octave, and the "serial date number" format is documented as

A single number equal to the number of days since January 0, 0000 in the proleptic ISO calendar (specifying use of the Gregorian calendar).

In Octave, they document

Return the date/time input as a serial day number, with Jan 1, 0000 defined as day 1.

The gregorian calender does not use a year zero. But Matlab and Octave refer to the year zero. Does this mean that they refer to year -1 BC, as in the astronomical year numbering?

Days before "October 15, 1582" are "wrong by as much as eleven days", according to the octave manual, which is considerably smaller than a complete year. So I'm trying to sort out this ambiguity.

like image 425
Johannes Schaub - litb Avatar asked Dec 01 '25 03:12

Johannes Schaub - litb


1 Answers

Firstly, note that the MATLAB and Octave definitions are equivalent

[MATLAB] N = "number of days since Jan 0, 0000"[OCTAVE] "Jan 1, 0000 is day 1"

Since N = 1 on day 1.


The Wikipedia page on "Year Zero" (which you linked to) offers this:

[...] the year 1 BC is followed by AD 1. However, there is a year zero in astronomical year numbering (where it coincides with the Julian year 1 BC) and in ISO 8601:2004 (where it coincides with the Gregorian year 1 BC), as well as in all Buddhist and Hindu calendars.

MATLAB and Octave appear to have followed the ISO standard, as stated in the datetime docs:

datetime arrays represent points in time using the proleptic ISO calendar

So the year zero, and hence the datenum value of 1 days, coincides with the first day of 1BC. Per the definitions at the top of this answer

"day 1"
= 1/Jan/0000
= datenum(1)
= datetime( 1, 'ConvertFrom', 'datenum' )
= datetime( 0, 0, 1 )

We can test using datenum (number of days) and datetime (datetime type object)

datenum( 0, 0, 1 ) % = 1, as defined by the docs

datetime( 1, 'ConvertFrom', 'datenum' )     
% = 1/Jan/0000 00:00:00

datetime( 1 + 366, 'ConvertFrom', 'datenum' )
% = 1/Jan/0001 00:00:00
% First day of year 1 after 366 days (leap year 0000 + 1 for Jan 1 )
like image 113
Wolfie Avatar answered Dec 02 '25 19:12

Wolfie



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!