Home > Blockchain >  Laravel Get Days In Month From Month Number?
Laravel Get Days In Month From Month Number?

Time:10-13

In Laravel Application I have month number like 01, 02, 03 upto 12. I want to get all days in this month. I cannot use daysInMonth() as I do not have a date all I have is month number.

Carbon::now()->daysInMonth();

how can I make this?

CodePudding user response:

You can do so

Carbon::now()->month($month_number)->daysInMonth;

// ...

Carbon::now()->month(02)->daysInMonth; // 28
  • Related