0
function firstOfMonth() {
return date("m/d/Y", strtotime(date('m').'/01/'.date('Y').' 00:00:00'));
}
function lastOfMonth() {
return date("m/d/Y", strtotime('-1 second',strtotime('+1 month',strtotime(date('m').'/01/'.date('Y').' 00:00:00'))));
}
是我必須得到當前的第一天的日期和最後一天的日期。在PHP中抓取特定月份的第一個日期和最後日期
現在我想改變它,所以在這兩個函數中他們有一個$月的參數,其中$月份保存月我想從第一個日期和最後日期的數字。
如果我做firstOfMonth(1),我想它返回2012-01-01和lastOfMonth(1)它應該返回例2012-01-31
我怎樣才能做到這一點?
可能有[如何得到一個月的第一天和最後一天](http://stackoverflow.com/questions/7541938/how-to-get-the-first-and-last-days-of-a-give-month) – deceze 2012-02-10 09:44:37