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

Next
About this episode
Leave a rating/review
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

Get immediate access to this and 4,000+ other videos and books.

Take your career further with a Kodeco Pro subscription. With unlimited access to over 40+ books and 4,000+ professional videos in a single subscription, it's simply the best investment you can make in your development career.

Learn more Already a subscriber? Sign in.

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.

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")