https://github.com/rendfall/from-seconds
Convert seconds to minutes, hours, days, months, years...
https://github.com/rendfall/from-seconds
convert days hours months seconds years
Last synced: 3 months ago
JSON representation
Convert seconds to minutes, hours, days, months, years...
- Host: GitHub
- URL: https://github.com/rendfall/from-seconds
- Owner: rendfall
- License: mit
- Created: 2019-04-04T19:37:40.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-04-06T14:31:30.000Z (about 7 years ago)
- Last Synced: 2025-04-13T03:56:47.528Z (about 1 year ago)
- Topics: convert, days, hours, months, seconds, years
- Language: TypeScript
- Homepage:
- Size: 5.86 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# from-seconds ([npm](https://www.npmjs.com/package/from-seconds))
[](https://badge.fury.io/js/from-seconds)
Convert seconds to minutes, hours, days, months, years...
## Install
```
$ npm install from-seconds
```
## Usage
Pass in seconds (as a `number` or `string`), and get an object:
```js
import { fromSeconds } from 'from-seconds';
const result = fromSeconds(31503661);
result.toMinutes();
// => { minutes: 525061, seconds: 1 }
result.toHours();
// => { hours: 8751, minutes: 1, seconds: 1 }
result.toDays();
// => { days: 364, hours: 15, minutes: 1, seconds: 1 }
result.toMonths();
// => { months: 11, days: 29, hours: 15, minutes: 1, seconds: 1 }
result.toYears();
// => { years: 0, months: 11, days: 29, hours: 15, minutes: 1, seconds:1 }
```
## License
[The MIT License](https://rendfall.mit-license.org) @ 2019