List of usage examples for java.time LocalTime withSecond
public LocalTime withSecond(int second)
From source file:Main.java
public static void main(String[] args) { LocalTime l = LocalTime.now(); LocalTime s = l.withSecond(1234); System.out.println(s);// w w w . j a va 2 s . c om }
From source file:com.haulmont.cuba.web.widgets.CubaTimeField.java
protected LocalTime applyResolutionToValue(LocalTime value) { if (value == null) { return null; }/*from w ww . j a v a 2 s . com*/ 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; }