alcamo/time

Date/time-related classes

Installs: 72

Dependents: 2

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/alcamo/time

0.2.1 2026-02-05 15:36 UTC

This package is auto-updated.

Last update: 2026-02-05 15:37:17 UTC


README

use alcamo\time\Duration;

$duration = new Duration('P0M1DT02.50S');

echo "$duration\n";

echo $duration->getTotalMinutes() . "\n";

echo $duration->getTotalSeconds() . "\n";

This will output:

P1DT2.5S
1440
86402.5

Unlike PHP's built-in DateInterval::__construct(), Duration::__construct() can handle fractions of seconds.

Furthermore, methods are provided to get the total number of days, hours, minutes and seconds.