LocalTime withMinute(int minute) example

Description

LocalTime withMinute(int minute) returns a copy of this LocalTime with the minute-of-hour value altered.

Syntax

withMinute has the following syntax.


public LocalTime withMinute(int minute)

Example

The following example shows how to use withMinute.


import java.time.LocalTime;
/*  w ww.  j a va  2  s .  c o m*/
public class Main {
  public static void main(String[] args) {
    LocalTime l = LocalTime.now();
    LocalTime s = l.withMinute(34);
    System.out.println(s);
  }
}

The code above generates the following result.





















Home »
  Java Date Time »
    java.time Reference »




Clock
DayOfWeek
Duration
Instant
LocalDate
LocalDateTime
LocalTime
Month
MonthDay
OffsetDateTime
OffsetTime
Period
Year
YearMonth
ZonedDateTime
ZoneId
ZoneOffset