Get days of the week in detail in kotlin

Asked 2 years ago, Updated 2 years ago, 106 views

"We are looking for a way to get ""how many Wednesday of that month"" from the app side on kotlin."

kotlin

2022-09-29 22:24

1 Answers

You will be implementing the TemporalAdjuster (tutorial).

An example of a questionnaire is a built-in method called TemporalAdjusters.dayOfWeekInMonth().

import java.time.DayOfWeek
import java.time.LocalDate
import java.time.temporal.TemporalAdjusters

funmain(){
    valbase=LocalDate.of (2021, 12, 3)
    value=base.with (TemporalAdjusters.dayOfWeekInMonth(2,DayOfWeek.WEDNESDAY))
    println(date)//2021-12-08
}


2022-09-29 22:24

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.