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

Introduction to Date and Time API

Introduction to Date and Time API

HASUNUMA Kenji

November 10, 2012
Tweet

More Decks by HASUNUMA Kenji

Other Decks in Programming

Transcript

  1. Introduction to  Date and Time API HASUNUMA Kenji Vice

    president, GlassFish Users Group Japan [email protected] Twitter: @btnrouge November 10, 2012
  2. JSR 310 : Date and Time API wDateɺCalendarɺDateFormat౳Λஔ͖ ׵͑Δ͜ͱ͕໨త wISO

    8601ܗࣜͷ೔෇ɾ࣌ࠁදݱ wImmutable͔ͭεϨουηʔϑͳAPI wઃܭࢥ૝͸Joda-Timeʹࠅࣅ
  3. JSR 310 : Date and Time API 2007೥2݄JSR 310ঝೝɺEGൃ଍ 2008೥5݄JavaOne

    2008Ͱൃද 2010೥3݄Early Draft Review (1ճ໨) 2012೥10݄Early Draft Review (2ճ໨) 2013೥10݄ Java SE 8ϦϦʔε
  4. java.util.Date JSR 310 ΦϒδΣΫτ Mutable Immutable ਫ਼౓ ϛϦඵ φϊඵ ϑΟʔϧυR/W

    Calendarܦ༝ ௚઀αϙʔτ λΠϜκʔϯ αϙʔτ αϙʔτ toString໭Γ஋ Unixܗࣜ ISO 8601ܗࣜ ೔෇ͱ࣌ࠁͷ෼཭ ෆՄ Մೳ ೔෇ԋࢉ ൺֱͷΈ ༷ʑͳ೔෇ԋࢉ ؔ࿈Ϋϥε਺ ਺ݸ ͨ͘͞Μ
  5. σϝϦοτ w αΠζ͕େ͖͍ Ϋϥε਺͕ଟ͍ 
 ˠJava SE APIͷதͰ΋࠷େڃ w طଘAPIͱͷޓ׵ੑʹ๡͍͠

    w ࠓޙͷల։ JPA΍JAXB΁ͷରԠ ͕ෆ໌ྎ w Early Draft Reviewޙ΋සൟͳ࢓༷มߋ
  6. ࢀߟ: ISO 8601ܗࣜ w ೔෇yyyy-MM-dd • 2012-11-10 w ࣌ࠁhh:mm:ss.SSSZ •

    07:30:00.000Z w ೔࣌yyyy-MM-dd’T’HH:mm:ss.SSSZ • 2012-11-10T07:30:00.000Z
  7. DateTimeΠϯλϑΣʔεͷ࣮૷ • LocalDate, LocalTime, LocalDateTime • OffsetDate, OffsetTime, OffsetDateTime •

    ZonedDateTime • ෆ଍৘ใͷ௥Ճ·ͨ͸༨৒৘ใͷ੾Γࣺ ͯʹΑΓ૬ޓʹม׵Մ
  8. %BUF 5JNF %BUF5JNF -PDBM ೥݄೔ ! ࣌ࠩ৘ใͳ͠ ! ࣌෼ඵະຬ ࣌ࠩ৘ใͳ͠

    ೥݄೔ ࣌෼ඵະຬ ࣌ࠩ৘ใͳ͠ 0⒎TFU ೥݄೔ ! 65$͔Βͷ࣌ࠩ ! ࣌෼ඵະຬ 65$͔Βͷ࣌ࠩ ೥݄೔ ࣌෼ඵະຬ 65$͔Βͷ࣌ࠩ ;POFE /" /" ೥݄೔ ࣌෼ඵະຬ λΠϜκʔϯ
  9. ChronologyͷαϒΫϥε • ISOChronology - ISO 8601 ඪ४  • JapaneseChronology࿨ྐྵ

    ೔ຊ  • ThaiBuddhistChronology෹ྐྵ λΠ  • MinguoChronologyຽࠃلݩ ୆࿷  • HijrahChronologyΠεϥϜྐྵ
  10. JSR 310ͷϦιʔε JSR 310 Specification http://jcp.org/en/jsr/detail?id=310 JSR 310 RI “ThreeTen”

    http://threeten.sourceforge.net https://github.com/ThreeTen/threeten