Increase days to php current Date()

php supports c style date functions. You can add or substract date-periods with English-language style phrases via the strtotime function. examples… $Today=date(‘y:m:d’); // add 3 days to date $NewDate=Date(‘y:m:d’, strtotime(‘+3 days’)); // subtract 3 days from date $NewDate=Date(‘y:m:d’, strtotime(‘-3 days’)); // PHP returns last sunday’s date $NewDate=Date(‘y:m:d’, strtotime(‘Last Sunday’)); // One week from last sunday … Read more

Calculate days between two Dates in Java 8

If you want logical calendar days, use DAYS.between() method from java.time.temporal.ChronoUnit: LocalDate dateBefore; LocalDate dateAfter; long daysBetween = DAYS.between(dateBefore, dateAfter); If you want literal 24 hour days, (a duration), you can use the Duration class instead: LocalDate today = LocalDate.now() LocalDate yesterday = today.minusDays(1); // Duration oneDay = Duration.between(today, yesterday); // throws an exception Duration.between(today.atStartOfDay(), … Read more