JavaScript Date.now() 时间格式叫什么?
What is the JavaScript Date.now() time format called?
我想知道在我的文档中写些什么。
MDN describes it 如:
A Number representing the milliseconds elapsed since the UNIX epoch.
而 W3Schools describes it 为:
the number of milliseconds since 1970/01/01
但是,这些只是描述。 Unix time 的维基百科页面指出:
Unix time is a system for describing instants in time, defined as the number of seconds that have elapsed since 00:00:00 Coordinated Universal Time (UTC), Thursday, 1 January 1970 [...]
秒。不是 毫秒 ,如 Date.now()
返回的那样。所以我也不能真正称它为 "unix time format"。
"number representing the milliseconds elapsed since the UNIX epoch"时间格式有没有更简洁的名字?
一般来说,如果你只说"Unix Time"或"Unix Timestamp",就暗示你是以秒为单位说话。但是,请理解 POSIX 规范实际上并未使用这些术语。相反,它专门说 "Seconds Since the Epoch",在 section 4.16 中定义,并在整个规范中使用。我们称它为 "Unix Time" 只是一种口语。
在section 20.3.1.1 of version 8.0 of the ECMAScript specification中,除了"milliseconds since 01 January, 1970 UTC".
,时间戳没有给出其他术语
因此,当提及 JavaScript(以及其他地方)中使用的时间戳时,您可以随意称呼它 "Milliseconds Since the (Unix) Epoch"、"Unix Time in Milliseconds" 或 "Unix Timestamp in Milliseconds" . 没有比这更简洁的公认的口语或标准术语。
关于这个主题的其他几点:
您提供的 W3Schools link 上的文本犯了一个严重错误,因为它没有指定 UTC。由于 Unix 纪元是根据 UTC 定义的,因此从中派生的所有时间戳都是基于 UTC 的。
有些人可能将这些时间戳称为 "epoch time"。然而,这是荒谬的。请避免使用此术语,因为它暗示时间值本身就是一个纪元。只有 0
值可以被认为是纪元。有人可能会说 "epoch-based time",但即便如此,也存在 "which epoch?" 的问题。虽然 Unix 纪元很常见,但有 multiple different epochs used in computing.
我想知道在我的文档中写些什么。
MDN describes it 如:
A Number representing the milliseconds elapsed since the UNIX epoch.
而 W3Schools describes it 为:
the number of milliseconds since 1970/01/01
但是,这些只是描述。 Unix time 的维基百科页面指出:
Unix time is a system for describing instants in time, defined as the number of seconds that have elapsed since 00:00:00 Coordinated Universal Time (UTC), Thursday, 1 January 1970 [...]
秒。不是 毫秒 ,如 Date.now()
返回的那样。所以我也不能真正称它为 "unix time format"。
"number representing the milliseconds elapsed since the UNIX epoch"时间格式有没有更简洁的名字?
一般来说,如果你只说"Unix Time"或"Unix Timestamp",就暗示你是以秒为单位说话。但是,请理解 POSIX 规范实际上并未使用这些术语。相反,它专门说 "Seconds Since the Epoch",在 section 4.16 中定义,并在整个规范中使用。我们称它为 "Unix Time" 只是一种口语。
在section 20.3.1.1 of version 8.0 of the ECMAScript specification中,除了"milliseconds since 01 January, 1970 UTC".
,时间戳没有给出其他术语因此,当提及 JavaScript(以及其他地方)中使用的时间戳时,您可以随意称呼它 "Milliseconds Since the (Unix) Epoch"、"Unix Time in Milliseconds" 或 "Unix Timestamp in Milliseconds" . 没有比这更简洁的公认的口语或标准术语。
关于这个主题的其他几点:
您提供的 W3Schools link 上的文本犯了一个严重错误,因为它没有指定 UTC。由于 Unix 纪元是根据 UTC 定义的,因此从中派生的所有时间戳都是基于 UTC 的。
有些人可能将这些时间戳称为 "epoch time"。然而,这是荒谬的。请避免使用此术语,因为它暗示时间值本身就是一个纪元。只有
0
值可以被认为是纪元。有人可能会说 "epoch-based time",但即便如此,也存在 "which epoch?" 的问题。虽然 Unix 纪元很常见,但有 multiple different epochs used in computing.