Example usage for java.time LocalTime plusMinutes

List of usage examples for java.time LocalTime plusMinutes

Introduction

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

Prototype

public LocalTime plusMinutes(long minutesToAdd) 

Source Link

Document

Returns a copy of this LocalTime with the specified number of minutes added.

Usage

From source file:Main.java

public static void main(String[] args) {
    LocalTime l = LocalTime.now();
    LocalTime s = l.plusMinutes(1234);
    System.out.println(s);/*  w  w w. j  a  v a2 s  .com*/
}

From source file:squash.booking.lambdas.core.PageManager.java

private List<String> getTimeSlotLabels() {

    // First time slot of the day is 10am...
    // ...so initialise to one time slot (i.e. 45 minutes) earlier
    logger.log("About to get time slot labels");
    LocalTime time = LocalTime.of(9, 15);
    List<String> timeSlots = new ArrayList<>();
    DateTimeFormatter formatter = DateTimeFormatter.ofPattern("h:mm a");
    for (int slots = 1; slots <= 16; slots++) {
        time = time.plusMinutes(45);
        timeSlots.add(time.format(formatter));
    }//from  w ww . j  a  va  2 s  .c  om
    logger.log("Got slot labels: " + timeSlots);

    return timeSlots;
}