String to LocalDateTime, LocalDateTime to String

공부는 혼자하는 거·2023년 5월 30일
0

JAVA & Kotlin Tip

목록 보기
11/11

    @Test
    fun dateFormatTest() {

        val dateTimeFormatter = DateTimeFormatter.ofPattern("yyyyMMdd")

        val recurringNext = "20230624"
        val date = LocalDate.parse(recurringNext, dateTimeFormatter)
        val dateTime = LocalDateTime.of(date, LocalDateTime.MAX.toLocalTime())

        println(dateTime)

        val nextMonth = dateTime.plusMonths(1)
        println(nextMonth)

        val format = dateTimeFormatter.format(nextMonth).toString()\
        println(format)

    }

https://lenditkr.github.io/MySQL/fractional-seconds-rouding-problem/

profile
시간대비효율

0개의 댓글