javascript - Date() 的时间源是什么?

标签 javascript date

我无法找到 JavaScript Date() 方法的源代码。

  • 是来自最终用户 PC 的时间吗?
  • 它来自全局时间服务器吗?

最佳答案

The specification says :

When Date is called as a function rather than as a constructor, it returns a String representing the current time (UTC).

此外,如果您将 Date 函数作为构造函数调用,it says :

...the time value (UTC) identifying the current time

因此,在这两种情况下,规范都表示“当前时间”。如何确定“当前时间”取决于实现者(即浏览器),但它通常由其运行的设备上的时间驱动。

关于javascript - Date() 的时间源是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37182036/

相关文章:

javascript - 编写简单的 JQuery 插件

java - 在java代码中使用EST时区时的DST

PHP 今天的日期形式

date - BigQuery (BQ) - 删除分区

javascript - Jshint 与 Closure |动态属性

javascript - AngularJS 中的警报计时器值

javascript - 移动浏览器是否支持使用 HTML5 视频标签的 4k 视频?

javascript - Fanytree Init 上的事件节点

mysql - 如果负数 DATE_ADD() 相同,那么 MySQL 的 DATE_SUB() 函数有什么意义?

javascript - 文本框中的日期,格式为 yyyy-mm-dd