A basic documentation search would've been sufficient: https://carbon.nesbot.com/docs/#api-period
\Carbon\CarbonPeriod::since('09:00')->hours(2)->until('17:00')->toArray()
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I wonder if there is a Carbon method that can divide start and end time into intervals before I start implementing my own method. Basically I have an interval a start and end time like this, 9:00 am and 5:00 pm, from 9 to 5 there are 8 working hours and an interval of 2 hours mean (8/2) 4 intervals of 2 hours. expected output 9:00 am - 11:00 am 11:00 am - 1:00 pm 1:00 pm - 3:00 pm 3:00 pm - 5:00 pm
A basic documentation search would've been sufficient: https://carbon.nesbot.com/docs/#api-period
\Carbon\CarbonPeriod::since('09:00')->hours(2)->until('17:00')->toArray()
Please or to participate in this conversation.