We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hello,
I'm attempting to utilize the library for calculating durations between two dates. Here's an example:
<?php require 'vendor/autoload.php'; use Sifex\SlaTimer\SLA; use Sifex\SlaTimer\SLABreach; use Sifex\SlaTimer\SLASchedule; /** * Create a new SLA between 9am and 5:00pm weekdays */ $sla = SLA::fromSchedule( SLASchedule::create()->from('09:00:00')->to('17:00:00')->onWeekdays() ); $dateTime_start = DateTime::createFromFormat('H:i:s d-m-Y', '16:58:00 01-12-2023'); $dateTime_start->setTimezone(new DateTimeZone('UTC')); $utcFormat_start = $dateTime_start->format('H:i:s d-m-Y'); $dateTime_end = DateTime::createFromFormat('H:i:s d-m-Y', '09:01:01 04-12-2023'); $dateTime_end->setTimezone(new DateTimeZone('UTC')); $utcFormat_end = $dateTime_end->format('H:i:s d-m-Y'); $duration = $sla->duration($utcFormat_start, $utcFormat_end); var_dump($duration->totalSeconds); var_dump($duration->forHumans());
Output :
int(120) string(9) "2 minutes"
The expected result is 3 minutes 1 second. Can you help me understand why it's calculating this way?
3 minutes 1 second
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hello,
I'm attempting to utilize the library for calculating durations between two dates. Here's an example:
Output :
The expected result is
3 minutes 1 second
. Can you help me understand why it's calculating this way?The text was updated successfully, but these errors were encountered: