Help - Calculate the time span in time range between checkin & checkout

Posted 2 months ago by GTHell

I have a time range of 20:00-8:00 and I want to calculate the time span between checkout and checkin but only count the time that is inside the time range. For example, if I checkin in 2019-09-15 23:00:00 and checkout at 2019-09-16 10:00:00 then the time span is only 9 hours.

Has anyone done something like this before? Seem easy to solve from reading but inevitable without using formula or face a if-else hell.

Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up


Reply to

Use Markdown with GitHub-flavored code blocks.