Here you can find the source of setTime(LocalDateTime source, String time)
public static LocalDateTime setTime(LocalDateTime source, String time)
//package com.java2s; //License from project: Open Source License import java.time.LocalDateTime; import java.time.LocalTime; import java.time.format.DateTimeFormatter; public class Main { private static DateTimeFormatter timeFormatter = DateTimeFormatter.ofPattern("HH:mm"); public static LocalDateTime setTime(LocalDateTime source, String time) { LocalTime tmp = LocalTime.parse(time, timeFormatter); return source.withHour(tmp.getHour()) // .withMinute(tmp.getMinute()); }/*from ww w .ja v a 2 s .com*/ }