日期 Date Methods

Lodash v4 集合的使用方法

_.now()

获取自 Unix 纪元 (1 January 1970 00:00:00 UTC) 以来经过的毫秒数的时间戳。

引入版本 2.4.0

source / npm package

返回 (number): 返回时间戳。

示例

js
_.defer((stamp) => {
  console.log(_.now() - stamp)
}, _.now())
// => Logs the number of milliseconds it took for the deferred invocation.