Upgrade to Pro — share decks privately, control downloads, hide ads and more …

TryDateLibraryofAndroid

97370d6641bedd9849c3974c65935c0d?s=47 futabooo
January 23, 2016

 TryDateLibraryofAndroid

97370d6641bedd9849c3974c65935c0d?s=128

futabooo

January 23, 2016
Tweet

Transcript

  1. Try Date Library of Android @futabooo

  2. futabooo(Takahiro futagawa) - Engineer at eureka, Inc. - Android Developer

    futabooo futabooo
  3. Topics ‣ java.util.Date and java.util.Calendar ‣ Android Date Library ‣

    Joda-Time-Android ‣ Date4j ‣ ThreeTenABP
  4. java.util.Date java.util.Calendar

  5. java.util.Date and java.util.Calendar ‣ The Java classes for handling dates

    ‣ Have been mostly unchanged since JDK1.0 ‣ And suffer from well-known issues ‣ for example January starts from 0 leading to many off-by-one bugs
  6. Joda-Time-Android ‣ Date calculation

  7. ‣ Date period Joda-Time-Android

  8. Joda-Time-Android

  9. Joda-Time-Android ‣ Joda-Time for Android ‣ Joda-Time eases the pain

    and tedium of manipulating dates and time ‣ Joda-Time greatly inflates its memory footprint on apps. ‣ Avoids the problem for Android by loading from resources instead of a JAR ‣ Has extra utilities designed for Android
  10. Joda-Time-Android ‣ Add the following dependency to build.gradle ‣ Initialize

    the library before using
  11. ‣ Date calculation Joda-Time-Android

  12. ‣ Date period Joda-Time-Android

  13. Date4j

  14. Date4j ‣ Eases the pain and tedium of manipulating dates

    and time ‣ Different scope from Joda-Time ‣ Number of classes < 10 ‣ Works in tandem with some JDK Date classes ‣ Supports nanosecond resolutions ‣ And more
  15. Date4j ‣ Add the following dependency to build.gradle

  16. Date4j ‣ Date calculation

  17. Date4j ‣ Date period • Ignore hour,minitue,secounds

  18. ThreeTenABP

  19. ThreeTenABP ‣ An adaptation of the JSR-310 backport for Android

    ‣ JSR-310 was included in Java 8 as the java.time.* package ‣ Full replacement for the ailing Date and Calendar
  20. ThreeTenABP ‣ Add the following dependency to build.gradle ‣ Initialize

    the library before using
  21. ThreeTenABP ‣ Date calculation

  22. ThreeTenABP ‣ Date period

  23. ·ͱΊ ‣ java.util.Date and java.util.Calendar died ‣ Joda-Time-Android fat ‣

    Date4j old ‣ ThreeTenABP cool Let’s use ThreeTenABP
  24. ࢀߟจݙ ‣ https://dzone.com/articles/game-over-jdks-date-and-time-c ‣ http://www.joda.org/joda-time/ ‣ https://github.com/dlew/joda-time-android ‣ http://blog.danlew.net/2013/08/20/joda_time_s_memory_issue_in_android/ ‣

    http://www.date4j.net/ ‣ https://github.com/JakeWharton/ThreeTenABP ‣ https://twitter.com/jakewharton/status/606158843249364993
  25. Thank you Credit: NASA Earth Observatory/NOAA NGDC