UNPKG

613 BJavaScriptView Raw
1"use strict";
2exports.fromUnixTime = fromUnixTime;
3var _index = require("./toDate.js");
4
5/**
6 * @name fromUnixTime
7 * @category Timestamp Helpers
8 * @summary Create a date from a Unix timestamp.
9 *
10 * @description
11 * Create a date from a Unix timestamp (in seconds). Decimal values will be discarded.
12 *
13 * @param unixTime - The given Unix timestamp (in seconds)
14 *
15 * @returns The date
16 *
17 * @example
18 * // Create the date 29 February 2012 11:45:05:
19 * const result = fromUnixTime(1330515905)
20 * //=> Wed Feb 29 2012 11:45:05
21 */
22function fromUnixTime(unixTime) {
23 return (0, _index.toDate)(unixTime * 1000);
24}