Skip to content

Instantly share code, notes, and snippets.

View MattStrauss's full-sized avatar
🏠
Working from home

Matt Strauss MattStrauss

🏠
Working from home
View GitHub Profile
@MattStrauss
MattStrauss / date_stuff.php
Last active April 9, 2021 12:25
Count number of day occurrences in a given period with Nesbot Carbon and PHP/Laravel
/**
* @param $timePeriod
* @param $day
*
* @return int
*/
private function getNumberOfSpecificDaysInPeriod($timePeriod, $day)
{
$numberOfDaysInPeriod = $this->geDaysInPeriod($timePeriod) - 1;