Created
March 7, 2020 04:41
-
-
Save anta40/9e985812938c55fa041a18b44db16ad4 to your computer and use it in GitHub Desktop.
Menghitung selisih 2 tanggal (dalam hari) di PHP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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