回答編集履歴
3
修正
test
CHANGED
@@ -12,6 +12,20 @@
|
|
12
12
|
|
13
13
|
// string(10) "2017-03-31"
|
14
14
|
|
15
|
+
|
16
|
+
|
17
|
+
$fdom->modify('15 days ago');
|
18
|
+
|
19
|
+
$ldom->modify('+15 days');
|
20
|
+
|
21
|
+
var_dump($fdom->format('Y-m-d'));
|
22
|
+
|
23
|
+
var_dump($ldom->format('Y-m-d'));
|
24
|
+
|
25
|
+
// string(10) "2017-02-14"
|
26
|
+
|
27
|
+
// string(10) "2017-04-15"
|
28
|
+
|
15
29
|
```
|
16
30
|
|
17
31
|
こういうことではなく?
|
2
元に戻す
test
CHANGED
@@ -2,19 +2,15 @@
|
|
2
2
|
|
3
3
|
$fdom = (new DateTime())->modify('first day of this month');
|
4
4
|
|
5
|
-
$fdom->modify('+15 days');
|
6
|
-
|
7
5
|
$ldom = (new DateTime())->modify('last day of this month');
|
8
|
-
|
9
|
-
$ldom->modify('+15 days');
|
10
6
|
|
11
7
|
var_dump($fdom);
|
12
8
|
|
13
9
|
var_dump($ldom);
|
14
10
|
|
15
|
-
// string(10) "2017-03-1
|
11
|
+
// string(10) "2017-03-01"
|
16
12
|
|
17
|
-
// string(10) "2017-0
|
13
|
+
// string(10) "2017-03-31"
|
18
14
|
|
19
15
|
```
|
20
16
|
|
1
修正
test
CHANGED
@@ -1,17 +1,21 @@
|
|
1
1
|
```php
|
2
2
|
|
3
|
-
$fdom = (new DateTime())->modify('first day of this month
|
3
|
+
$fdom = (new DateTime())->modify('first day of this month');
|
4
4
|
|
5
|
+
$fdom->modify('+15 days');
|
6
|
+
|
5
|
-
$ldom = (new DateTime())->modify('last day of this month
|
7
|
+
$ldom = (new DateTime())->modify('last day of this month');
|
8
|
+
|
9
|
+
$ldom->modify('+15 days');
|
6
10
|
|
7
11
|
var_dump($fdom);
|
8
12
|
|
9
13
|
var_dump($ldom);
|
10
14
|
|
11
|
-
// string(10) "2017-03-
|
15
|
+
// string(10) "2017-03-16"
|
12
16
|
|
13
|
-
// string(10) "2017-0
|
17
|
+
// string(10) "2017-04-15"
|
14
18
|
|
15
19
|
```
|
16
20
|
|
17
|
-
|
21
|
+
こういうことではなく?
|