-
-
Save mikkame/334ce035b16c7ddb96c7947e3539efd4 to your computer and use it in GitHub Desktop.
laravel de calender
This file contains hidden or 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
function calendar() | |
{ | |
$cal = []; | |
foreach (range(0, 6) as $add) { | |
$m = Carbon::parse(date('Y-m-01'))->addMonth($add); | |
$ym = $m->format('Y年m月'); | |
foreach (range(0, $m->format('t')-1) as $addd) { | |
$date = $m->copy()->addDay($addd); | |
$w = $date->format('w'); | |
$W = $date->format('W'); | |
if ($w == 0) { | |
$W++; | |
} | |
$cal[$ym][$W][$w] = [$date->format('Y-n-d'), $date->format('j')]; | |
} | |
} | |
return $cal; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment