napi_create_date


napi_status napi_create_date(napi_env env,
                             double time,
                             napi_value* result); 
  • [in] env:调用该 API 时所处的环境。
  • [in] time:自协调世界时 (UTC) 1970 年 1 月 1 日起的 ECMAScript 时间值(以毫秒为单位)。
  • [out] result:一个表示 JavaScript Datenapi_value

如果 API 成功,则返回 napi_ok

【Returns napi_ok if the API succeeded.】

该 API 不考虑闰秒;它们会被忽略,因为 ECMAScript 遵循 POSIX 时间规范。

【This API does not observe leap seconds; they are ignored, as ECMAScript aligns with POSIX time specification.】

此 API 分配一个 JavaScript Date 对象。

【This API allocates a JavaScript Date object.】

JavaScript Date 对象在 ECMAScript 语言规范的 部分日期对象 中有描述。

【JavaScript Date objects are described in Section Date objects of the ECMAScript Language Specification.】