Wrangling Dates & Time in Android

Dec 15 2022 Kotlin 1.6.21, Android 13, IntelliJ 2022.1

Part 1: Wrangling Dates & Time in Android

4. Store Dates & Times Using Date Classes

Episode complete

Play next episode

Save for later
About this episode
See forum comments
Cinema mode Mark complete Download course materials
Previous episode: 3. Use Duration, Period & ChronoUnit to Calculate Time Next episode: 5. Localize With ZonedDateTime

This video Store Dates & Times Using Date Classes was last updated on Dec 15 2022

Heads up... You've reached locked video content where the transcript will be shown as obfuscated text.

You can unlock the rest of this video course, and our entire catalogue of books and videos, with a kodeco.com Professional subscription.

In the Java Date-Time library, there’s several classes you can use to store a date and time. The most important ones are LocalDate, LocalTime, and one more class that combines these two classes into one, called LocalDateTime.

val myBirthDay = LocalDate.of(1999, Month.DECEMBER, 29)
println("myBirthDay: $myBirthDay")
val birthDayOfTheWeek = myBirthDay.dayOfWeek
println("You're born on: $birthDayOfTheWeek")
val alarm = LocalTime.of(7, 30)
println("meetingTime: $alarm")
val reminder = LocalDateTime.of(2022, Month.SEPTEMBER, 10, 9, 0)
println("reminder: $reminder")
val monthDay = MonthDay.now()
println("monthDay: $monthDay")
val yearMonth = YearMonth.now()
println("yearMonth: $yearMonth")
val year = Year.now()
println("year: $year")