Example usage for java.time LocalTime MIDNIGHT

List of usage examples for java.time LocalTime MIDNIGHT

Introduction

In this page you can find the example usage for java.time LocalTime MIDNIGHT.

Prototype

LocalTime MIDNIGHT

To view the source code for java.time LocalTime MIDNIGHT.

Click Source Link

Document

The time of midnight at the start of the day, '00:00'.

Usage

From source file:Main.java

public static void main(String[] args) {
    Duration duration = Duration.between(LocalTime.MIDNIGHT, LocalTime.NOON);
    System.out.println(duration.getSeconds());

    duration = duration.multipliedBy(2);

    System.out.println(duration.getSeconds());

}

From source file:Main.java

public static void main(String[] args) {
    Duration duration = Duration.between(LocalTime.MIDNIGHT, LocalTime.NOON);
    System.out.println(duration.get(ChronoUnit.SECONDS));

}

From source file:Main.java

public static void main(String[] args) {
    Duration duration = Duration.between(LocalTime.MIDNIGHT, LocalTime.NOON);
    System.out.println(duration.getSeconds());
    duration = duration.plus(4, ChronoUnit.DAYS);
    System.out.println(duration.getSeconds());

}

From source file:Main.java

public static void main(String[] args) {
    Duration duration = Duration.between(LocalTime.MIDNIGHT, LocalTime.NOON);
    System.out.println(duration.getSeconds());
    duration = duration.minus(3, ChronoUnit.DAYS);
    System.out.println(duration.getSeconds());

}

From source file:Main.java

public static void main(String[] args) {
    Duration duration = Duration.between(LocalTime.MIDNIGHT, LocalTime.NOON);
    List<TemporalUnit> l = duration.getUnits();
    for (TemporalUnit u : l) {
        System.out.println(u);/*from  w  w  w  . ja  v  a 2 s .co m*/
    }
}

From source file:Main.java

public static void main(String[] args) {
    LocalDate february20th = LocalDate.of(2014, Month.FEBRUARY, 20);
    System.out.println(february20th);
    System.out.println(LocalDate.from(february20th.plus(15, ChronoUnit.YEARS))); // 2029-02-20
    System.out.println(LocalDate.MAX);
    System.out.println(LocalDate.MIN);

    System.out.println(LocalTime.MIDNIGHT); // 00:00
    System.out.println(LocalTime.NOON); // 12:00
    System.out.println(LocalTime.of(23, 12, 30, 500)); // 23:12:30.000000500
    System.out.println(LocalTime.now()); // 00:40:34.110
    System.out.println(LocalTime.ofSecondOfDay(11 * 60 * 60)); // 11:00
    System.out.println(LocalTime.from(LocalTime.MIDNIGHT.plusHours(4))); // 04:00
    System.out.println(LocalTime.MIN);
    System.out.println(LocalTime.MAX);

    System.out.println(LocalDateTime.of(2014, 2, 15, 12, 30, 50, 200)); // 2014-02-15T12:30:50.000000200
    System.out.println(LocalDateTime.now()); // 2014-02-28T17:28:21.002
    System.out.println(LocalDateTime.from(LocalDateTime.of(2014, 2, 15, 12, 30, 40, 500).plusHours(19))); // 2014-02-16T07:30:40.000000500
    System.out.println(LocalDateTime.MAX);
}

From source file:viewmodel.TeamResult.java

public String getTeamTime() {
    LocalTime lt = LocalTime.MIDNIGHT.plus(teamDuration);
    teamTime = DateTimeFormatter.ISO_LOCAL_TIME.format(lt);
    return teamTime;
}

From source file:mServer.tool.MserverDatumZeit.java

public static long getSecondsUntilNextDay() {
    // now//from  w  ww. j ava2 s  .  co m
    LocalDateTime now = LocalDateTime.now();
    // tomorrow 0:00
    LocalDateTime future = LocalDateTime.of(LocalDate.now(), LocalTime.MIDNIGHT).plusDays(1L);
    Duration duration = Duration.between(now, future);
    return duration.getSeconds();
}

From source file:com.haulmont.cuba.web.widgets.CubaTimeField.java

protected LocalTime applyResolutionToValue(LocalTime value) {
    if (value == null) {
        return null;
    }//from  ww  w .j  a  v a  2s.  co  m

    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;
}

From source file:ch.digitalfondue.npjt.query.DateTimeQueriesTest.java

private void check(DateQueries dq, String key, LocalDate now) {
    Assert.assertEquals(now, dq.findByKey(key).valueLocalDate);
    Assert.assertEquals(LocalDateTime.of(now, LocalTime.MIDNIGHT), dq.findByKey(key).valueLocalDateTime);
}