How to find out the amount of between two dates. For an example how many days have passed since a defined date.

Source code viewer

// Define start date, from which we want to start the count. $start_date = new DateTime("2016-01-14"); // Current date, to do the difference calculation. // Calculate difference of the dates and show the difference in days. $days = (int) $current->diff($start_date)->format("%a"); // If the days are divisible by 4. if (!($days % 4)) { // ... }Programming Language: PHP