Waiting for Xmas: Date-Differenzen in Tagen

Die Differenz zwischen zwei Datumswerten in Tagen:

Java (LocalDateTime)

if(ldt1.isAfter(ldt2)){
days = Duration.between(ldt1.toLocalDate().atStartOfDay(), ldt2.toLocalDate().atStartOfDay()).toDays();
days = Math.abs(days);
}


Java (Date)

long days = TimeUnit.DAYS.convert(date.getTime() - date2.getTime(), TimeUnit.MILLISECONDS);


PHP

$interval = date_diff($datetime1, $datetime2);
$days = (int) $interval->format('%a');


(MySQL) SQL

select datediff('2017-12-24', current_date) waitingforxmas;


(Oracle) SQL

SELECT TO_DATE('2017-12-24', 'YYYY-MM-DD') - CURRENT_DATE WaitingForXmas
FROM dual
User annonyme 2017-11-30 21:40

write comment:
Five + = 11

Möchtest Du AdSense-Werbung erlauben und mir damit helfen die laufenden Kosten des Blogs tragen zu können?