Code example for GregorianCalendar

Methods: addgetTimesetsetTimeInMillis

0
        Assert.notNull(_timeService, "Time service is null.");
 
        Date result = TimeParser.convert(_text);
 
        if (result != null) {
            Calendar calendar = new GregorianCalendar();
            calendar.setTimeInMillis(_timeService.getCurrentTime());
            calendar.add(Calendar.DAY_OF_MONTH, -1);
            calendar.set(Calendar.HOUR_OF_DAY, DateParserTools.getHour(result));
            calendar.set(Calendar.MINUTE, DateParserTools.getMinute(result));
            calendar.set(Calendar.SECOND, 0);
 
            result = calendar.getTime();
        } 
 
        return result;
    } 
} 
Stop searching for code, let great code find you!  Add Codota to your java IDE