Home > Software design >  Get first day of current month in php [closed]
Get first day of current month in php [closed]

Time:09-30

I am looking for a similar PHP date function. I need the current month's first day. This month is September. the September month's first day is Wednesday. I need this one like this. Advance Thanks

CodePudding user response:

Here you go:

$thisMonthsFirstDay = (new DateTime('first day of this month'))->format('l');

Also always take a look into the documentation, you can learn a lot from there.

CodePudding user response:

You could simply do the following:

echo date("l", strtotime("2021-09-01")); // Wednesday
echo date("l", strtotime("2021-08-01")); // Sunday
  •  Tags:  
  • php
  • Related