<?php
$today = date("Y-m-d H:i:s");
$datetime1 = date_create('2017-03-23');
$datetime2 = date_create($today);
$interval = date_diff($datetime1, $datetime2);
echo " Current time ". $today."<br>";
echo $interval->format('%h hrs')."<br>";
echo $interval->format('%d days')."<br>";
?>
Current time 2017-03-24 22:13:5922 hrs
1 days
$today = date_create(date("Y-m-d"));
$datetime1 = date_create('2018-12-23');
$datetime2 =date_create($today);
$date1=date_create("2018-12-15");
$diff=date_diff($date1,$today);
$interval=$diff;
http://php.net/manual/en/dateinterval.format.php
No hay comentarios:
Publicar un comentario