λ°μν
Intro
μλ
νμΈμ. μ΄λ² μκ°μλ μ½νλ¦°μμ νμ¬ λ μ§ DateTime μμ μκ° μΆκ°νλ λ²μ λν΄ μμλ³΄κ² μ΅λλ€.
How to implement
μ°μ LocalDateTime μ ν΅ν΄ νμ¬ λ μ§ λ° μκ°μ ꡬν©λλ€. κ·Έ μ΄ν plusHours λ©μλλ₯Ό ν΅ν΄ μνλ κ°λ§νΌ μκ°μ λν΄μ£Όλ©΄ λ©λλ€.
import java.time.LocalDate
import java.time.LocalDateTime
fun main(args: Array<String>) {
val todayDateTime: LocalDateTime = LocalDateTime.now()
println("Current date and time: $todayDateTime")
println("Add 9 Hour date and time: ${todayDateTime.plusHours(9)}")
}
κΆκΈνμ λΆλ€μ kotlin playground μμ μ§μ νλ² μ€νν΄λ³΄μΈμ!
https://play.kotlinlang.org/
λ°μν