Carbon Question really, making a only time stamp from a timestamp

Posted 9 months ago by dan3460

I have an array of time slots for a specific day of the week. In the other hand i have a timestamp for a specific date and time. The time slots are formated as "08:00", "08:15", etc. i can easily make them into a carbon time using Carbon::createFromFormat(), no problem there. So in order to compare the timestamp with my time slots, seems to me that i have to get the timestamp, convert it to string, extract the time and convert that back to a carbon date to make the comparison. I looked in the Carbon docs but could not find either been able to compare only times or directly create a carbon date from the time part of the timestamp. I hope this is not too confusing

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

Channels

Reply to

Use Markdown with GitHub-flavored code blocks.