SlideShare a Scribd company logo
Java 
8 
Date 
& 
Time 
API 
Speaker: 
Oleg 
Tsal-­‐Tsalko(@tsaltsol)
About 
me 
Oleg 
Tsal-­‐Tsalko 
Lead 
So:ware 
Engineer 
at 
EPAM 
Systems. 
Speaker, 
acEve 
member 
of 
Kiev 
JUG. 
ParEcipate 
in 
different 
educaEonal 
iniEaEves 
and 
JCP/AdoptJSR 
programs.
Benefits 
• JSR-­‐310: 
New 
Date 
& 
Time 
API 
• Replaces 
old 
ambiguous 
java.uEl.Date, 
Calendar, 
TimeZone, 
DateFormat 
classes 
• More 
fluent/simple/clean 
API 
• Immutable 
classes 
• Using 
Java8 
features 
including 
lambdas 
• Precise 
separaEon 
of 
concepts
Range 
of 
types 
• LocalDate 
– 
a 
date 
only 
• LocalTime 
– 
a 
Eme 
only 
• LocalDateTime 
– 
date 
with 
Eme 
• ZonedDateTime 
– 
date 
with 
Eme 
in 
Eme 
zone 
• Period 
-­‐ 
date-­‐based 
amount 
of 
Eme 
• Dura>on 
-­‐ 
Eme-­‐based 
amount 
of 
Eme 
• And 
more…
TimeZones 
If 
you 
can 
avoid 
using 
TimeZones 
– 
do 
it! 
If 
not 
– 
use 
ZonedDateAndTime!
TimeZone 
classes 
in 
Java 
8 
• ZoneId 
– 
replacement 
for 
TimeZone 
class 
(e.g. 
“Europe/London”, 
“Europe/Kiev”) 
• ZoneOffset 
– 
represenEng 
offset 
from 
UTC 
Eme 
• ZoneRules 
– 
behind 
the 
scenes 
class 
which 
defines 
Eme 
zone 
rules 
• ZonedDateTime 
– 
main 
date/Eme 
class 
which 
is 
aware 
of 
Eme 
zones
Power 
of 
abstracEon 
New 
API 
is 
very 
flexible 
because 
it 
based 
on 
number 
of 
abstracEons 
at 
it’s 
boeom: 
• Temporal 
– 
parent 
class 
for 
all 
date/Eme 
objects 
which 
defines 
mutaEon 
operaEon 
for 
them 
such 
as 
plus/ 
minus/with 
• TemporalAdjuster 
– 
funcEonal 
interface 
which 
responsible 
for 
mutaEng 
Temporal 
objects 
• TemporalField 
– 
represents 
parts/fields 
of 
date/Eme 
objects 
such 
as 
(DAY_OF_WEEK, 
MONTH, 
etc.) 
• TemporalUnit 
– 
represents 
type 
of 
date/Eme 
values 
such 
as 
(MINUTES, 
DAYS, 
YEARS, 
etc.) 
• TemporalAmount 
– 
class 
which 
represents 
amount 
of 
Eme
Java 8 date & time javaday2014
Links 
• heps://today.java.net/pub/a/today/2008/09/18/ 
jsr-­‐310-­‐new-­‐java-­‐date-­‐Eme-­‐api.html 
• hep://blog.joda.org/2009/11/why-­‐jsr-­‐310-­‐isn-­‐ 
joda-­‐Eme_4941.html 
• heps://blogs.oracle.com/thejavatutorials/entry/ 
javaone_2013_jdk_8_date 
• hep://vimeo.com/87157763 
• hep://parleys.com/play/ 
52508380e4b0c4f11ec57665/about 
• hep://www.oracle.com/events/us/en/java8/ 
index.html
Thank 
you! 
Oleg 
Tsal-­‐Tsalko 
Email: 
oleg.tsalko@gmail.com 
Twieer: 
@tsaltsol

More Related Content

PDF
Neptune @ SoCal
PPTX
Running on Elastic Beanstalk
PDF
AppScale @ LA.rb
PDF
Active Cloud DB at CloudComp '10
PPTX
Java Ahead-Of-Time compilation
PPTX
Groovy puzzlers по русски с Joker 2014
PDF
Together Cheerfully to Walk with Hypermedia
PPTX
TestNG vs JUnit: cease fire or the end of the war
Neptune @ SoCal
Running on Elastic Beanstalk
AppScale @ LA.rb
Active Cloud DB at CloudComp '10
Java Ahead-Of-Time compilation
Groovy puzzlers по русски с Joker 2014
Together Cheerfully to Walk with Hypermedia
TestNG vs JUnit: cease fire or the end of the war

Similar to Java 8 date & time javaday2014 (20)

PDF
Java 8 date & time
PPTX
Fun times with ruby
PPTX
Java 8 Date-Time API
PPTX
Java 8
PPTX
SFDC Introduction to Apex
PPTX
Complete PPT about the Java lokesh kept it
PPTX
A Quick peek @ New Date & Time API of Java 8
PPTX
Java utility classes
PDF
Journey towards serverless infrastructure
PPTX
Improved Developer Productivity In JDK8
PDF
Eliminating the Pauses in your Java Application
PPT
learn JAVA at ASIT with a placement assistance.
PPTX
Eclipse UOMo
PPTX
Automation of Deep learning training with AWS Step Functions
PDF
Introduction to Java 8 java.time
PPTX
What’s new in java 8
PPTX
JavaOne 2011 Recap
PDF
Dev112 let's calendar that
PPTX
PDF
What's new in Solr 5.0
Java 8 date & time
Fun times with ruby
Java 8 Date-Time API
Java 8
SFDC Introduction to Apex
Complete PPT about the Java lokesh kept it
A Quick peek @ New Date & Time API of Java 8
Java utility classes
Journey towards serverless infrastructure
Improved Developer Productivity In JDK8
Eliminating the Pauses in your Java Application
learn JAVA at ASIT with a placement assistance.
Eclipse UOMo
Automation of Deep learning training with AWS Step Functions
Introduction to Java 8 java.time
What’s new in java 8
JavaOne 2011 Recap
Dev112 let's calendar that
What's new in Solr 5.0
Ad

More from Oleg Tsal-Tsalko (13)

PPTX
Developer on a mission (Devoxx UA 2021)
PPTX
Developer on a mission
PPTX
From Streams to Reactive Streams
PDF
Java 9 Jigsaw HackDay
PDF
JUG UA AdoptJSR participation
PDF
Develop modern apps using Spring ecosystem at time of BigData
PDF
Java 8 features
PDF
Lambdas HOL
PDF
Get ready for spring 4
PDF
Enterprise Integration Patterns
PPTX
Distributed systems and scalability rules
PPTX
Next stop: Spring 4
PPTX
JUG involvment in JCP and AdopJSR program
Developer on a mission (Devoxx UA 2021)
Developer on a mission
From Streams to Reactive Streams
Java 9 Jigsaw HackDay
JUG UA AdoptJSR participation
Develop modern apps using Spring ecosystem at time of BigData
Java 8 features
Lambdas HOL
Get ready for spring 4
Enterprise Integration Patterns
Distributed systems and scalability rules
Next stop: Spring 4
JUG involvment in JCP and AdopJSR program
Ad

Recently uploaded (20)

PDF
PPT on Performance Review to get promotions
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PPTX
CH1 Production IntroductoryConcepts.pptx
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PDF
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PDF
composite construction of structures.pdf
PPTX
Safety Seminar civil to be ensured for safe working.
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PPTX
Geodesy 1.pptx...............................................
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
DOCX
573137875-Attendance-Management-System-original
PPT
Mechanical Engineering MATERIALS Selection
PDF
Unit I ESSENTIAL OF DIGITAL MARKETING.pdf
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPTX
Artificial Intelligence
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PPT
introduction to datamining and warehousing
PPT on Performance Review to get promotions
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
CH1 Production IntroductoryConcepts.pptx
Embodied AI: Ushering in the Next Era of Intelligent Systems
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
composite construction of structures.pdf
Safety Seminar civil to be ensured for safe working.
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
Geodesy 1.pptx...............................................
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
573137875-Attendance-Management-System-original
Mechanical Engineering MATERIALS Selection
Unit I ESSENTIAL OF DIGITAL MARKETING.pdf
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
Artificial Intelligence
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
introduction to datamining and warehousing

Java 8 date & time javaday2014

  • 1. Java 8 Date & Time API Speaker: Oleg Tsal-­‐Tsalko(@tsaltsol)
  • 2. About me Oleg Tsal-­‐Tsalko Lead So:ware Engineer at EPAM Systems. Speaker, acEve member of Kiev JUG. ParEcipate in different educaEonal iniEaEves and JCP/AdoptJSR programs.
  • 3. Benefits • JSR-­‐310: New Date & Time API • Replaces old ambiguous java.uEl.Date, Calendar, TimeZone, DateFormat classes • More fluent/simple/clean API • Immutable classes • Using Java8 features including lambdas • Precise separaEon of concepts
  • 4. Range of types • LocalDate – a date only • LocalTime – a Eme only • LocalDateTime – date with Eme • ZonedDateTime – date with Eme in Eme zone • Period -­‐ date-­‐based amount of Eme • Dura>on -­‐ Eme-­‐based amount of Eme • And more…
  • 5. TimeZones If you can avoid using TimeZones – do it! If not – use ZonedDateAndTime!
  • 6. TimeZone classes in Java 8 • ZoneId – replacement for TimeZone class (e.g. “Europe/London”, “Europe/Kiev”) • ZoneOffset – represenEng offset from UTC Eme • ZoneRules – behind the scenes class which defines Eme zone rules • ZonedDateTime – main date/Eme class which is aware of Eme zones
  • 7. Power of abstracEon New API is very flexible because it based on number of abstracEons at it’s boeom: • Temporal – parent class for all date/Eme objects which defines mutaEon operaEon for them such as plus/ minus/with • TemporalAdjuster – funcEonal interface which responsible for mutaEng Temporal objects • TemporalField – represents parts/fields of date/Eme objects such as (DAY_OF_WEEK, MONTH, etc.) • TemporalUnit – represents type of date/Eme values such as (MINUTES, DAYS, YEARS, etc.) • TemporalAmount – class which represents amount of Eme
  • 9. Links • heps://today.java.net/pub/a/today/2008/09/18/ jsr-­‐310-­‐new-­‐java-­‐date-­‐Eme-­‐api.html • hep://blog.joda.org/2009/11/why-­‐jsr-­‐310-­‐isn-­‐ joda-­‐Eme_4941.html • heps://blogs.oracle.com/thejavatutorials/entry/ javaone_2013_jdk_8_date • hep://vimeo.com/87157763 • hep://parleys.com/play/ 52508380e4b0c4f11ec57665/about • hep://www.oracle.com/events/us/en/java8/ index.html
  • 10. Thank you! Oleg Tsal-­‐Tsalko Email: oleg.tsalko@gmail.com Twieer: @tsaltsol