Check Date if Saturday or Sunday

时间:2019-03-19 14:56:32

标签: php date

I know this question has many answers on the site, but I need a different thing.

I have an array of dates of the current month, now I want to get the days that are Saturday and Sunday.

$dates = array ('2019-03-01', '2019-03-02', '2019-03-03', '2019-03-04', ...);

I found a function that checks TODAY, but I want it to check any date with this format: YYYY-MM-DD

if(date('D') == 'Sat' || date('D') == 'Sun') { 
  echo "Today is Saturday or Sunday.";
} else {
  echo "Today is not Saturday or Sunday.";
}

0 个答案:

没有答案