|
1 | | -# Seconds |
2 | | - |
3 | | -[](https://github.com/adevade/seconds) |
4 | | -[](https://packagist.org/packages/adevade/seconds) |
5 | | -[](https://packagist.org/packages/adevade/seconds) |
6 | | - |
7 | | -Helpers for converting time to seconds. |
8 | | - |
9 | | -## Installation |
10 | | - |
11 | | -You can install the package via composer: |
12 | | - |
13 | | -```bash |
14 | | -composer require adevade/seconds |
15 | | -``` |
16 | | - |
17 | | -## Usage |
18 | | - |
19 | | -```php |
20 | | -use Adevade\Seconds; |
21 | | - |
22 | | -Seconds::fromMinutes(2); // returns => (int) 120 |
23 | | -``` |
24 | | - |
25 | | -### Available methods |
26 | | - |
27 | | -```php |
28 | | -Seconds::fromMinutes($minutes = 5); |
29 | | -Seconds::fromHours($hours = 12); |
30 | | -Seconds::fromDays($days = 4); |
31 | | -Seconds::fromWeeks($weeks = 2); |
32 | | -Seconds::fromMonths($months = 6); |
33 | | -Seconds::fromYears($years = 2); |
34 | | - |
35 | | -Seconds::fromMinute(); |
36 | | -Seconds::fromHour(); |
37 | | -Seconds::fromDay(); |
38 | | -Seconds::fromWeek(); |
39 | | -Seconds::fromMonth(); |
40 | | -Seconds::fromYear(); |
41 | | -``` |
42 | | - |
43 | | -### Available constants |
44 | | - |
45 | | -```php |
46 | | -Seconds::MINUTE; |
47 | | -Seconds::HOUR; |
48 | | -Seconds::DAY; |
49 | | -Seconds::WEEK; |
50 | | -Seconds::MONTH; |
51 | | -Seconds::YEAR; |
52 | | -``` |
53 | | - |
54 | | -> Months have an average length of 30.42 days.\ |
55 | | -> Years have an average length of 365.24 days. |
56 | | -
|
57 | | -## Credits |
58 | | - |
59 | | -- [Andréas Lundgren](https://github.com/adevade) |
60 | | - |
61 | | -Idea came from [this tweet by @LasseRafn](https://twitter.com/LasseRafn/status/1225017098373685255). Thanks! |
| 1 | +# Seconds |
| 2 | + |
| 3 | +[](https://github.com/adevade/seconds) |
| 4 | +[](https://packagist.org/packages/adevade/seconds) |
| 5 | +[](https://packagist.org/packages/adevade/seconds) |
| 6 | + |
| 7 | +Helpers for converting time to seconds. |
| 8 | + |
| 9 | +## Installation |
| 10 | + |
| 11 | +You can install the package via composer: |
| 12 | + |
| 13 | +```bash |
| 14 | +composer require adevade/seconds |
| 15 | +``` |
| 16 | + |
| 17 | +## Usage |
| 18 | + |
| 19 | +```php |
| 20 | +use Adevade\Seconds; |
| 21 | + |
| 22 | +Seconds::fromMinutes(2); // returns => (int) 120 |
| 23 | +``` |
| 24 | + |
| 25 | +### Available methods |
| 26 | + |
| 27 | +```php |
| 28 | +Seconds::fromMinutes($minutes = 5); |
| 29 | +Seconds::fromHours($hours = 12); |
| 30 | +Seconds::fromDays($days = 4); |
| 31 | +Seconds::fromWeeks($weeks = 2); |
| 32 | +Seconds::fromMonths($months = 6); |
| 33 | +Seconds::fromYears($years = 2); |
| 34 | + |
| 35 | +Seconds::fromMinute(); |
| 36 | +Seconds::fromHour(); |
| 37 | +Seconds::fromDay(); |
| 38 | +Seconds::fromWeek(); |
| 39 | +Seconds::fromMonth(); |
| 40 | +Seconds::fromYear(); |
| 41 | +``` |
| 42 | + |
| 43 | +### Available constants |
| 44 | + |
| 45 | +```php |
| 46 | +Seconds::MINUTE; |
| 47 | +Seconds::HOUR; |
| 48 | +Seconds::DAY; |
| 49 | +Seconds::WEEK; |
| 50 | +Seconds::MONTH; |
| 51 | +Seconds::YEAR; |
| 52 | +``` |
| 53 | + |
| 54 | +> Months have an average length of 30.42 days.\ |
| 55 | +> Years have an average length of 365.24 days. |
| 56 | +
|
| 57 | +## Credits |
| 58 | + |
| 59 | +- [Andréas Lundgren](https://github.com/adevade) |
| 60 | + |
| 61 | +Idea came from [this tweet by @LasseRafn](https://twitter.com/LasseRafn/status/1225017098373685255). Thanks! |
0 commit comments