了解JavaScript / node.js中的UTC与GMT标准时间

时间:2016-09-02 15:26:35

标签: javascript node.js utc gmt

我有一些单元测试失败,错误如:

EXCEPTION: Error: This operation is not supported in the environment this application is running on. 

"location.protocol" must be http or https and web storage must be enabled.

BrowserDomAdapter.logError @ browser_adapter.js:84
BrowserDomAdapter.logGroup @ browser_adapter.js:94
ExceptionHandler.call @ exception_handler.js:65
next @ application_ref.js:348
schedulerFn @ async.js:89
SafeSubscriber.__tryOrUnsub @ Subscriber.js:225
SafeSubscriber.next @ Subscriber.js:174
Subscriber._next @ Subscriber.js:124
Subscriber.next @ Subscriber.js:88
Subject._finalNext @ Subject.js:128
Subject._next @ Subject.js:120
Subject.next @ Subject.js:77
EventEmitter.emit @ async.js:77
onError @ ng_zone.js:124
onHandleError @ ng_zone_impl.js:74
ZoneDelegate.handleError @ zone.js:368
Zone.runTask @ zone.js:297
ZoneTask.invoke @ zone.js:464

一组结果来自Unix上的节点6.5.0,另一个结果来自Windows上的另一个节点6.5.0。

这很奇怪,因为我认为UTC GMT。

  • UTC与GMT相同吗?
  • 如果没有,有什么区别?
  • 一个人比另一个好吗?

进一步测试设置 - "dateModified": "Fri Mar 06 2015 00:00:00 GMT+0000 (UTC)" - "datePublished": "Fri Mar 06 2015 00:00:00 GMT+0000 (UTC)" + "dateModified": "Fri Mar 06 2015 00:00:00 GMT+0000 (GMT Standard Time)" + "datePublished": "Fri Mar 06 2015 00:00:00 GMT+0000 (GMT Standard Time)" 环境变量:

在更改时区之前:

TZ

更改时区后:

$ node
> new Date().toString()
'Fri Sep 02 2016 17:14:36 GMT+0100 (GMT Daylight Time)'

0 个答案:

没有答案