PHP code example of brekitomasson / seconds

1. Go to this page and download the library: Download brekitomasson/seconds library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

brekitomasson / seconds example snippets


Seconds::fromMinutes(1);
// 60

Seconds::fromMinutes(32);
// 1920

Seconds::fromHours(3);
// 180

Seconds::fromDays(3)
// 259200

Secnds::fromWeeks(4)
// 2419200

Seconds::fromMinutes(-1);
// 60

Seconds::fromHours(3) + Seconds::fromMinutes(30);
// 12600

use Breki\Seconds;Seconds::fromWeeks(13);
// 7862400

Seconds::fromDays(31 + 30 + 31);
// 7948800

$date1 = Carbon::parse('2023-09-23 07:14:00 UTC')
$date2 = Carbon::parse('2023-12-31 23:59:59 UTC')

$date1->diffInSeconds($date2)
> 8613959