index.js 621 B

123456789101112131415161718192021222324
  1. var parse = require('../parse/index.js')
  2. /**
  3. * @category Millisecond Helpers
  4. * @summary Get the milliseconds of the given date.
  5. *
  6. * @description
  7. * Get the milliseconds of the given date.
  8. *
  9. * @param {Date|String|Number} date - the given date
  10. * @returns {Number} the milliseconds
  11. *
  12. * @example
  13. * // Get the milliseconds of 29 February 2012 11:45:05.123:
  14. * var result = getMilliseconds(new Date(2012, 1, 29, 11, 45, 5, 123))
  15. * //=> 123
  16. */
  17. function getMilliseconds (dirtyDate) {
  18. var date = parse(dirtyDate)
  19. var milliseconds = date.getMilliseconds()
  20. return milliseconds
  21. }
  22. module.exports = getMilliseconds