Java Date Time Java Java API
java.time.LocalTime
public LocalTime withMinute(int minute)
Returns a copy of this LocalTime with the minute-of-hour field replaced with the specified value.
package com.logicbig.example.localtime;import java.time.LocalTime;public class WithMinuteExample { public static void main (String... args) { LocalTime t = LocalTime.of(5, 1, 5, 3000); System.out.println(t); LocalTime t2 = t.withMinute(43); System.out.println(t2); }}
05:01:05.00000305:43:05.000003