Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ugate/time-parts
Extracts time parts from nanoseconds or milliseconds with label formatter
https://github.com/ugate/time-parts
Last synced: 9 days ago
JSON representation
Extracts time parts from nanoseconds or milliseconds with label formatter
- Host: GitHub
- URL: https://github.com/ugate/time-parts
- Owner: ugate
- Created: 2020-12-21T17:34:48.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2020-12-21T18:33:27.000Z (almost 4 years ago)
- Last Synced: 2024-09-29T05:57:23.912Z (about 2 months ago)
- Language: JavaScript
- Size: 2.93 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# time-parts
Extracts time parts from nanoseconds or milliseconds with label formatter```js
let timeLabel;timeLabel = time_parts.formattedTime(187568010012000n);
// result:
// 02:04:06:08.10.12timeLabel = time_parts.formattedTime(187568010012000n, 'LABEL', true);
// result:
// 02 days 04 hours 06 minutes 08 seconds 10 milliseconds 12 microsecondstimeLabel = time_parts.formattedTime(187568010012000n, 'ABBREVIATED', true);
// result:
// 02 days 04 hrs 06 mins 08 secs 10 ms 12 μstimeLabel = time_parts.formattedTime(187568010012000n, 'ABBREVIATED');
// result:
// 02days04hrs06mins08secs10ms12μs// omit zeroed days
timeLabel = time_parts.formattedTime(17568010012000n, 'LABEL', true, true);
// result:
// 04 hours 52 minutes 48 seconds 10 milliseconds 12 microseconds
```