Here you can find the source of balanceStartAndEndDateTime(LocalDateTime startDateTime, LocalDateTime endDateTime)
Parameter | Description |
---|---|
startDateTime | a parameter |
endDateTime | a parameter |
public static LocalDateTime balanceStartAndEndDateTime(LocalDateTime startDateTime, LocalDateTime endDateTime)
//package com.java2s; //License from project: Open Source License import java.time.LocalDateTime; public class Main { /**/*from w ww . jav a 2 s . com*/ * Takes two LocalDateTime and balances by ensuring that the latter DateTime is gaurenteed to be later * than the former DateTime * @param startDateTime * @param endDateTime * @return endDateTime that is now balanced */ public static LocalDateTime balanceStartAndEndDateTime(LocalDateTime startDateTime, LocalDateTime endDateTime) { LocalDateTime newEndDateTime = endDateTime; while (startDateTime.compareTo(newEndDateTime) >= 1) { newEndDateTime = newEndDateTime.plusDays(1); } return newEndDateTime; } }