<?php
// Define the current date
$current_date = strtotime('02-04-2024'); // Current Unix timestamp for the example
// Define the From date and To date from Table 1
$from_date_table1 = strtotime('20-03-2024');
$to_date_table1 = strtotime('30-05-2024');
// If To date is greater than current date, set it to current date
if ($to_date_table1 > $current_date) {
$to_date_table1 = $current_date;
}
// Calculate the total days between From date and adjusted To date
$total_days = floor(($to_date_table1 - $from_date_table1) / (60 * 60 * 24)) + 1; // Add 1 to include both From date and To date
// Output the total days
echo "Total days between From date and adjusted To date: " . $total_days . " days.\n";
?>
Comments
Post a Comment