{"id":15502061,"url":"https://github.com/sungwoncho/millisec","last_synced_at":"2025-04-15T16:35:06.914Z","repository":{"id":57297161,"uuid":"47871455","full_name":"sungwoncho/millisec","owner":"sungwoncho","description":"Prettify milliseconds with customizable format","archived":false,"fork":false,"pushed_at":"2016-05-14T00:34:05.000Z","size":11,"stargazers_count":60,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-07T22:38:03.782Z","etag":null,"topics":["javascript","nodejs","time"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sungwoncho.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-12-12T09:00:39.000Z","updated_at":"2024-07-29T12:59:36.000Z","dependencies_parsed_at":"2022-09-02T05:41:58.291Z","dependency_job_id":null,"html_url":"https://github.com/sungwoncho/millisec","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sungwoncho%2Fmillisec","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sungwoncho%2Fmillisec/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sungwoncho%2Fmillisec/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sungwoncho%2Fmillisec/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sungwoncho","download_url":"https://codeload.github.com/sungwoncho/millisec/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249109152,"owners_count":21214113,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","nodejs","time"],"created_at":"2024-10-02T09:07:26.711Z","updated_at":"2025-04-15T16:35:06.887Z","avatar_url":"https://github.com/sungwoncho.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# millisec\n\n[![Build Status](https://travis-ci.org/sungwoncho/millisec.svg?branch=master)](https://travis-ci.org/sungwoncho/millisec)\n\nTurn milliseconds into a human readable and customizable format.\n\n## Installation\n\n    npm install --save millisec\n\n## Usage\n\n```js\nvar millisec = require('millisec');\nvar ms = 93791334; // 1 day 2 hours 3 minutes 11.334 seconds\n\nmillisec(ms).format('DD - HH - MM - SS');\n// =\u003e '1 day - 2 hours - 3 minutes - 11 seconds'\n\nmillisec(ms).format('hh : mm : ss');\n// =\u003e '2 : 3 : 11'\n```\n\n## Documentation\n\nRequire the module and call it with the millisecond you wish to format. It will\nreturn an object that contains the following methods.\n\n### format(output)\n\nOutput a human readable string representation of the milliseconds with the\ngiven format.\n\n`output` is a required argument.\n\n* `dd` - raw days (e.g. 0, 1, 2, ...)\n* `hh` - raw hours with a maximum value `23`. (e.g. 0, 1, 2, ..., 23)\n* `mm` - raw minutes with a maximum value `59`. (e.g. 0, 1, 2, ..., 59)\n* `ss` - raw seconds with maximum value `59`. (e.g. 0, 1, 2, ..., 59)\n\n* `DD` - days followed by a count noun (e.g. 0 days, 1 day, 2 days, ...)\n* `HH` - hours followed by a count noun. The maximum value is `23`.\n (e.g. 0 hours, 1 hour, 2 hours, ...,  23 hours)\n* `MM` - minutes followed by a count noun. The maximum value is `59`.\n (e.g. 0 minutes, 1 minute, 2 minutes, ..., 59 minutes)\n* `SS` - seconds followed by a count noun. The maximum value is `59`.\n(e.g. 0 seconds, 1 second, 2 seconds, ..., 59 seconds)\n\n* `hhh` - the hours equivalent of the millisecond\n(e.g. 0, 1, 2, 24, ..., 48, ...)\n* `mmm` - the minutes equivalent of the millisecond (e.g. 0, 1, 2, ...,\n   100, ...)\n* `sss` - the seconds equivalent of the millisecond (e.g. 0, 1, 2, ...,\n  3500, ...)\n\n* `HHH` - the hours equivalent of the millisecond, followed by a count noun\n(e.g. 0 hours, 1 hour, 2 hours, ...,  24 hours, ..., 48 hours)\n* `MMM` - the minutes equivalent of the millisecond, followed by a count noun\n (e.g. 0 minutes, 1 minute, 2 minutes, ..., 100 minutes)\n* `SSS` - the seconds equivalent of the millisecond, followed by a count noun\n(e.g. 0 seconds, 1 second, 2 seconds, ..., 3500 seconds)\n\n```js\nvar millisec = require('millisec');\nvar ms = 93791334; // 1 day 2 hours 3 minutes 11.334 seconds\n\nmillisec(ms).format('HH MM SS');\n// =\u003e '2 hours 3 minutes 11 seconds'\nmillisec(ms).format('DAY (dd) HOURS (hh) MINUTES (mm)');\n// =\u003e 'DAY (1) HOURS (2) MINUTES (3)'\nmillisec(ms).format('MMM');\n// =\u003e '1563 minutes'\nmillisec(ms).format('Seconds left: sss');\n// =\u003e 'Seconds left: 93791'\n```\n\n### getDays\n\nGet the day component of the millisecond. The returned value is `Number`, not\na `String`. Returns `0` if the millisecond is less than one day.\n\n```js\nvar millisec = require('millisec');\nvar ms = 93791334; // 1 day 2 hours 3 minutes 11.334 seconds\n\nmillisec(ms).getDays();\n// =\u003e 1\n```\n\n### getHours\n\nGet the hour component of the millisecond. The returned value is `Number`, not\na `String`. If the millisecond is less than one hour, returns `0`.\n\n```js\nvar millisec = require('millisec');\nvar ms = 93791334; // 1 day 2 hours 3 minutes 11.334 seconds\n\nmillisec(ms).getHours();\n// =\u003e 2\n```\n\n### getMinutes\n\nGet the minute component of the millisecond. The returned value is `Number`, not\na `String`. If the millisecond is less than one minute, returns `0`.\n\n```js\nvar millisec = require('millisec');\nvar ms = 93791334; // 1 day 2 hours 3 minutes 11.334 seconds\n\nmillisec(ms).getMinutes();\n// =\u003e 3\n```\n\n### getSeconds\n\nGet the second component of the millisecond. The returned value is `Number`, not\na `String`. The decimals are ignored.\n\n```js\nvar millisec = require('millisec');\nvar ms = 93791334; // 1 day 2 hours 3 minutes 11.334 seconds\n\nmillisec(ms).getSeconds();\n// =\u003e 11\n```\n\n## Contributing\n\nRun `npm test` to run tests locally.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsungwoncho%2Fmillisec","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsungwoncho%2Fmillisec","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsungwoncho%2Fmillisec/lists"}