Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Seconds

Tests Latest Version on Packagist Total Downloads

Helpers for converting time to seconds.

Installation

You can install the package via composer:

composer require adevade/seconds

Usage

use Adevade\Seconds;

Seconds::fromMinutes(2); // returns => (int) 120

Available methods

Seconds::fromMinutes($minutes = 5);
Seconds::fromHours($hours = 12);
Seconds::fromDays($days = 4);
Seconds::fromWeeks($weeks = 2);
Seconds::fromMonths($months = 6);
Seconds::fromYears($years = 2);

Seconds::fromMinute();
Seconds::fromHour();
Seconds::fromDay();
Seconds::fromWeek();
Seconds::fromMonth();
Seconds::fromYear();

Available constants

Seconds::MINUTE;
Seconds::HOUR;
Seconds::DAY;
Seconds::WEEK;
Seconds::MONTH;
Seconds::YEAR;

Months have an average length of 30.42 days.
Years have an average length of 365.24 days.

Credits

Idea came from this tweet by @LasseRafn. Thanks!

You can’t perform that action at this time.