matlab - 自 "Jan 1, 0000": is this -1 BC or +1 CE? 起的序列日期号

标签 matlab date time octave year0

我正在 Matlab 和 Octave 中处理日期,“序列日期号”格式为 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).

在 Octave 中,they document

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

公历不使用year zero 。但Matlab和Octave指的是零年。这是否意味着它们指的是公元前-1年,如astronomical year numbering中所示?

根据 Octave 手册,“1582 年 10 月 15 日”之前的天“误差多达十一天”,这比一整年要小得多。所以我正在努力解决这个歧义。

最佳答案

首先,请注意 MATLAB 和 Octave 定义是等效的

[MATLAB] N = "自 0000 年 1 月 0 日以来的天数"[OCTAVE] "0000 年 1 月 1 日是第 1 天"

自第 1 天的 N = 1 起。

<小时/>

Wikipedia page on "Year Zero" (您链接到的)提供以下内容:

[...] 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 和 Octave 似乎遵循 ISO 标准,如 datetime docs 中所述。 :

datetime arrays represent points in time using the proleptic ISO calendar

因此,零年以及 1 天的 datenum 值与 1BC 的第一天一致。 根据此答案顶部的定义

"day 1"
= 1/Jan/0000
= datenum(1)
= datetime( 1, 'ConvertFrom', 'datenum' )
= datetime( 0, 0, 1 )
<小时/>

我们可以使用datenum(天数)和datetime(日期时间类型对象)进行测试

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 )

关于matlab - 自 "Jan 1, 0000": is this -1 BC or +1 CE? 起的序列日期号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59648597/

相关文章:

Android:有没有办法用 DateUtils 显示 "min"而不是 "minute"

matlab - 最初要求用户输入,但不等待回答立即继续执行剩余代码

matlab - 从 3d 矩阵 Matlab 中获取 2d 矩阵

java - 一年中两个日期之间的间隔时间

linux - Bash 相对日期(x 天前)

r - 如何创建地理空间/时间数据的动画

matlab - 绘制归一化均匀混合物

string - 如何在 MATLAB 中写入文本文件?

javascript - 二月出生日期验证

下面程序中的c程序错误?