When starting from ajava.util.date object: what is the best way getting the hour part as an integer regarding performance?
java.util.date
integer
I have to iterat
Date dateInput = new Date();
since calendar starts at 01.01.1970, 01:00. you have to make further modifications to the code.using below approach avoids that so this will performs faster.
01.01.1970, 01:00
dateInput.toInstant().atZone(ZoneId.systemDefault()).getHour();