alcamo/time

Date/time-related classes

Installs: 56

Dependents: 2

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/alcamo/time

0.2.0 2025-10-11 14:37 UTC

This package is auto-updated.

Last update: 2025-10-11 14:38:45 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.