carbon return 给定年份的天数
carbon return number of days for a given year
Carbon 可以 return 给定年份的天数吗?
$dt = Carbon::parse($year . '-'. 1 .'-' . $from);
var_dump($dt->format('z') + 1 );
这似乎不起作用
echo 'Days in the year: ', 365 + $dt->format('L');
L
: Whether it's a leap year; 1
if it is a leap year, 0
otherwise
您可以使用 comparison
echo 'Days in the year: ', ($dt->isLeapYear() ? 366 : 365);
你可以通过使用碳获得属性
Carbon::parse('2020-01')->daysInYear //for year
Carbon::parse('2020-01')->daysInMonth //for month
Carbon 可以 return 给定年份的天数吗?
$dt = Carbon::parse($year . '-'. 1 .'-' . $from);
var_dump($dt->format('z') + 1 );
这似乎不起作用
echo 'Days in the year: ', 365 + $dt->format('L');
L
: Whether it's a leap year;1
if it is a leap year,0
otherwise
您可以使用 comparison
echo 'Days in the year: ', ($dt->isLeapYear() ? 366 : 365);
你可以通过使用碳获得属性
Carbon::parse('2020-01')->daysInYear //for year
Carbon::parse('2020-01')->daysInMonth //for month