remove time from date php

Solutions on MaxInterview for remove time from date php by the best coders in the world

showing results for - "remove time from date php"
Melinda
11 Nov 2016
1$date = '2012-09-09 03:09:00';
2
3$createDate = new DateTime($date);
4
5$strip = $createDate->format('Y-m-d');
6var_dump($strip); // string(10) "2012-09-09"
7
8$now = new DateTime();
9$difference = $now->diff($createDate, true);
10var_dump($difference);
11
12/* object(DateInterval)#3 (8) {
13  ["y"]=>
14  int(0)
15  ["m"]=>
16  int(0)
17  ["d"]=>
18  int(7)
19  ["h"]=>
20  int(13)
21  ["i"]=>
22  int(4)
23  ["s"]=>
24  int(38)
25  ["invert"]=>
26  int(0)
27  ["days"]=>
28  int(7)
29} */
David
19 Apr 2019
1dont use php, use Blazor!