Code example for TimeUnit

Methods: toHours

0
            super(locale);
        } 
 
        @Override 
        public boolean canHandle(final Date date, final long delta) {
            long deltaHours = TimeUnit.MILLISECONDS.toHours(delta);
            return (deltaHours <= 12) ? true : false;
        } 
 
        @Override 
        public String format(final Date date, final long delta) {
            long hours = TimeUnit.MILLISECONDS.toHours(delta);
            return format("HourPastPattern" + getPlural(hours), hours);
        } 
    } 
 
    public static class Today extends AbstractDateHandler { 
 
        public Today(Locale locale) {
            super(locale);
        }