如何在php中获得某个月/年的第一天的日期名称


How do you get the name of the day that is the first day of the certain Month/Year in php?

我需要创建一个函数,该函数以月份和年份为参数,并返回月份的第一天的名称。

例如,今天是2012年3月30日,我如何知道哪一天是1日?我只知道2012年3月。很抱歉重复,我只是想说清楚。

使用strtotimedate函数的组合:

$f_dt = strtotime("$month/01/$year");
$day = date('D', $f_dt);

Ack,完全误读了。。。好的,应该是date('D',strtotime($year.'-'.$month.'-01'))

我假设你所说的日期是指周一、周二等。如果你想把日期写出来,而不是周一、周二等等,请把那里的"D"参数改为"l"(小写l)。