package com.app.demo1;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;

public class DayBoundaryCalculator {

    public static void main(String[] args) {
        LocalDateTime currentDateTime = LocalDateTime.now();
        LocalDateTime[] boundaries = getDayBoundary(currentDateTime);

        System.out.println("Current Date: " + currentDateTime.toLocalDate());
        System.out.println("Start of Day: " + boundaries[0]);
        System.out.println("End of Day: " + boundaries[1]);
    }


    public static LocalDateTime[] getDayBoundary(LocalDateTime currentDate) {
        LocalDateTime startOfDay = currentDate.with(LocalTime.MIN);
        LocalDateTime endOfDay = currentDate.with(LocalTime.MAX).plusSeconds(1);

        return new LocalDateTime[]{startOfDay, endOfDay};
    }

}
