回答編集履歴
2
エラー修正
test
CHANGED
@@ -18,7 +18,7 @@
|
|
18
18
|
|
19
19
|
array(
|
20
20
|
|
21
|
-
'key' => 'start' // フィールド名を指定
|
21
|
+
'key' => 'start', // フィールド名を指定
|
22
22
|
|
23
23
|
'value' => date('Y-m-d'),
|
24
24
|
|
@@ -30,7 +30,7 @@
|
|
30
30
|
|
31
31
|
array(
|
32
32
|
|
33
|
-
'key' => 'end' // フィールド名を指定
|
33
|
+
'key' => 'end', // フィールド名を指定
|
34
34
|
|
35
35
|
'value' => date('Y-m-d'),
|
36
36
|
|
1
追記
test
CHANGED
@@ -71,3 +71,29 @@
|
|
71
71
|
```
|
72
72
|
|
73
73
|
4月中ならこんな感じ。valueを動的にすれば自由自在です。
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
###【追記】値を動的にする
|
78
|
+
|
79
|
+
例えば来月
|
80
|
+
|
81
|
+
```PHP
|
82
|
+
|
83
|
+
$next_month_start = date('Y-m-d', strtotime('first day of next month', strtotime(date('Y-m-d'))));
|
84
|
+
|
85
|
+
$next_month_end = date('Y-m-d', strtotime('last day of next month', strtotime(date('Y-m-d'))));
|
86
|
+
|
87
|
+
echo $next_month_start; // 2018-05-01
|
88
|
+
|
89
|
+
echo $next_month_end; // 2018-05-31
|
90
|
+
|
91
|
+
```
|
92
|
+
|
93
|
+
[PHP: date - Manual ](http://php.net/manual/ja/function.date.php)
|
94
|
+
|
95
|
+
[PHP: strtotime - Manual ](http://php.net/manual/ja/function.strtotime.php)
|
96
|
+
|
97
|
+
使ってる関数はこの2つだけなのでマニュアルみていじってみてください。
|
98
|
+
|
99
|
+
`PHP 日付 来週`などのワードで検索しても沢山出てきます。
|