this is my first question on stack overflow. I have a date as input and output should be last date of the month that falls in.
for example
Input string "01/15/2023" should output "01/31/2023" or "02/10/2021" should output "02/28/2021" 0r
"02/10/2024" should output "02/29/2024" (Incase of leap year) etc all such rules applicable.
I have tried below code through online search of a java , but I am getting error which I am not able to figure it out, please do help me out.
val endDate: ZonedDateTime = ZonedDateTime.parse("2023-01-15")
println("1A. Last day of the current month: "+endDate.toLocalDateTime().with(TemporalAdjusters.lastDayOfMonth())