When you start with the java.util.date object: what is the best way to get the hour part as an integer regarding performance?
I need to repeat several million dates, so performance matters.
Usually I get an hour as follows, but maybe there are better ways?
java.util.Date date; Calendar calendar = Calendar.getInstance(); calendar.setTime(date); int hours = calendar.get(Calendar.HOUR_OF_DAY);
source share