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の最初の日付とlastdateを取得する
私はそれをalittleに変更したいので、両方の関数に$ monthというパラメタがあります。$ monthは最初の日付と最後の日付を取得したい月の番号を保持します。
例私はfirstOfMonth(1)、私はそれが2012年1月1日を返したいんやlastOfMonth(1)それは私がこれをどのように行うことができます2012-01-31
を返す必要があります?場合
可能な[どのように贈与月の最初と最後の日を取得する](http://stackoverflow.com/questions/7541938/how-to-get-the-first-and-last-days-of-a-give-month) – deceze