index.js 564 B

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