getTime.cjs 557 B

123456789101112131415161718192021222324
  1. "use strict";
  2. exports.getTime = getTime;
  3. var _index = require("./toDate.cjs");
  4. /**
  5. * @name getTime
  6. * @category Timestamp Helpers
  7. * @summary Get the milliseconds timestamp of the given date.
  8. *
  9. * @description
  10. * Get the milliseconds timestamp of the given date.
  11. *
  12. * @param date - The given date
  13. *
  14. * @returns The timestamp
  15. *
  16. * @example
  17. * // Get the timestamp of 29 February 2012 11:45:05.123:
  18. * const result = getTime(new Date(2012, 1, 29, 11, 45, 5, 123))
  19. * //=> 1330515905123
  20. */
  21. function getTime(date) {
  22. return +(0, _index.toDate)(date);
  23. }