List of usage examples for java.time LocalTime withHour
public LocalTime withHour(int hour)
From source file:Main.java
public static void main(String[] args) { LocalTime l = LocalTime.now(); LocalTime s = l.withHour(4); System.out.println(s);//from ww w . ja v a2 s . c o m }
From source file:com.haulmont.cuba.web.widgets.CubaTimeField.java
protected LocalTime applyResolutionToValue(LocalTime value) { if (value == null) { return null; }//from w w w. jav a 2 s .c om LocalTime result = LocalTime.MIDNIGHT; List<TimeResolution> resolutions = getResolutionsHigherOrEqualTo(getResolution()) .collect(Collectors.toList()); for (TimeResolution resolution : resolutions) { switch (resolution) { case HOUR: result = result.withHour(value.getHour()); break; case MINUTE: result = result.withMinute(value.getMinute()); break; case SECOND: result = result.withSecond(value.getSecond()); break; default: throw new IllegalArgumentException("Cannot detect resolution type"); } } return result; }