Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
为了获得给定月份的第一天,我使用了上面的strtotime但它不起作用我写:
$d = date_parse_from_format("d-m-Y", $date); $month= $d["month"]; $year=$d["year"]; echo date("d-m-Y", strtotime('FIRST DAY OF $month $year'));
这个月的第一天可以表示为
echo date('Y-m-01');
如果需要,您可以从中提取更多信息,例如星期几:
$month = '10'; $year = '2012'; echo date('D', strtotime("{$year}-{$month}-01"));
我希望它有效:
echo date("j", strtotime('FIRST DAY OF $month $year'));