<?php
$date1 = $TPC_From;
$date2 = $TPC_To;
$diff = abs(strtotime($date2) - strtotime($date1));
$years = floor($diff / (365*60*60*24));
$months = floor(($diff - $years * 365*60*60*24) / (30*60*60*24));
$days = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24));
printf("%d bulan, %d hari\n", $months, $days); ?>
You can customize the code using your own purposes..
writer : Sya Ahmad
Monday, 26 October 2015
PHP : Calculating differences between two date in months and days
2:45 pm
No comments
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment