Java Date rounding

If you use Apache commons-lang, you can use DateUtils to round your dates:

Date now = new Date();
Date nearestMinute = DateUtils.round(now, Calendar.MINUTE);

Leave a Comment