回答編集履歴
1
判定文を変更
answer
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
下記の様な取り方もできると思います。
|
2
2
|
|
3
3
|
```PHP
|
4
|
-
$targetDate = '2017-03-29';//入力日付
|
5
|
-
$startDate = date('Y-m-d', strtotime('first day of ' .
|
4
|
+
$startDate = date('Y-m-d', strtotime('first day of ' . date('Y-m-d')));//当月始め
|
6
5
|
$endDate = date('Y-m-d', strtotime('last day of '.date('Y-m-d',strtotime($startDate. ' 2 month'))));//翌々月末
|
6
|
+
$targetDate = '2017-06-01';//比較対象日付
|
7
7
|
if($startDate <= $targetDate && $targetDate <= $endDate){
|
8
8
|
echo '範囲内';
|
9
|
+
} else {
|
10
|
+
echo '範囲外';
|
9
11
|
}
|
10
12
|
```
|