Skip to content

Instantly share code, notes, and snippets.

@anta40
Created March 7, 2020 04:41
Show Gist options
  • Save anta40/9e985812938c55fa041a18b44db16ad4 to your computer and use it in GitHub Desktop.
Save anta40/9e985812938c55fa041a18b44db16ad4 to your computer and use it in GitHub Desktop.
Menghitung selisih 2 tanggal (dalam hari) di PHP
<?php
$time1 = new DateTime(date("Y-m-d"));
$time2 = new DateTime('2020-03-05');
$interval = $time1->diff($time2)->format("%r%a");
echo "$interval hari";
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment