回答編集履歴
1
判定文を変更
test
CHANGED
@@ -4,16 +4,20 @@
|
|
4
4
|
|
5
5
|
```PHP
|
6
6
|
|
7
|
-
$targetDate = '2017-03-29';//入力日付
|
8
|
-
|
9
|
-
$startDate = date('Y-m-d', strtotime('first day of ' .
|
7
|
+
$startDate = date('Y-m-d', strtotime('first day of ' . date('Y-m-d')));//当月始め
|
10
8
|
|
11
9
|
$endDate = date('Y-m-d', strtotime('last day of '.date('Y-m-d',strtotime($startDate. ' 2 month'))));//翌々月末
|
10
|
+
|
11
|
+
$targetDate = '2017-06-01';//比較対象日付
|
12
12
|
|
13
13
|
if($startDate <= $targetDate && $targetDate <= $endDate){
|
14
14
|
|
15
15
|
echo '範囲内';
|
16
16
|
|
17
|
+
} else {
|
18
|
+
|
19
|
+
echo '範囲外';
|
20
|
+
|
17
21
|
}
|
18
22
|
|
19
23
|
```
|