Answers for "how ro remove time form date php"

PHP
1

remove time from date php

$date = '2012-09-09 03:09:00';

$createDate = new DateTime($date);

$strip = $createDate->format('Y-m-d');
var_dump($strip); // string(10) "2012-09-09"

$now = new DateTime();
$difference = $now->diff($createDate, true);
var_dump($difference);

/* object(DateInterval)#3 (8) {
  ["y"]=>
  int(0)
  ["m"]=>
  int(0)
  ["d"]=>
  int(7)
  ["h"]=>
  int(13)
  ["i"]=>
  int(4)
  ["s"]=>
  int(38)
  ["invert"]=>
  int(0)
  ["days"]=>
  int(7)
} */
Posted by: Guest on June-08-2021
-1

remove time from date php

dont use php, use Blazor!
Posted by: Guest on June-08-2021

Browse Popular Code Answers by Language