Created
January 4, 2020 10:27
-
-
Save mass6/1a6da6114de1c83a2b6dd04af7fdfc57 to your computer and use it in GitHub Desktop.
Get start time rounded up to next 5 minutes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$currentMinute = Carbon::parse($userStartTime)->startOfMinute(); | |
$diff = (int) $this->roundUpToAny($currentMinute->minute, 5) - $currentMinute->minute; // 50 | |
$additionalMinutes = (integer) $this->roundUpToAny(mt_rand(120, 360), 5); | |
$start_time = $currentMinute->addMinutes($diff + $additionalMinutes); | |
dd($start_time); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment