Skip to content

Commit 4ec0efc

Browse files
committed
clean up date-time api chapter
1 parent ba6a1d4 commit 4ec0efc

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

08-date-time-api.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
Date Time API
22
-------
33

4-
So far in this [series](http://shekhargulati.com/7-days-with-java-8/) we have focussed on [functional](http://shekhargulati.com/2015/07/25/day-1-lets-learn-about-lambdas/) [aspects](http://shekhargulati.com/2015/07/26/day-2-lets-learn-about-streams/) of Java 8 and looked at how to design better API's using [Optional](http://shekhargulati.com/2015/07/28/day-4-lets-write-null-free-java-code/) and [default and static methods in Interfaces](http://shekhargulati.com/2015/08/22/day-5-default-and-static-interface-methods-in-java-8/). In this blog, we will learn about another new API that will change the way we work with dates -- Date Time API. Almost all Java developers will agree that date and time support prior to Java 8 is far from ideal and most of the time we had to use third party libraries like [Joda-Time](http://www.joda.org/joda-time/) in our applications. The new Date Time API is heavily influenced by Joda-Time API and if you have used it then you will feel home.
5-
6-
<!--more-->
4+
So far in this [book](https://github.com/shekhargulati/java8-the-missing-tutorial) we have focussed on [functional](./02-lambdas.md) [aspects](03-streams.md) of Java 8 and looked at how to design better API's using [Optional](05-optionals.md) and [default and static methods in Interfaces](./01-default-static-interface-methods.md). In this chapter, we will learn about another new API that will change the way we work with dates -- Date Time API. Almost all Java developers will agree that date and time support prior to Java 8 is far from ideal and most of the time we had to use third party libraries like [Joda-Time](http://www.joda.org/joda-time/) in our applications. The new Date Time API is heavily influenced by Joda-Time API and if you have used it then you will feel home.
75

86
## What's wrong with existing Date API?
97

@@ -99,7 +97,7 @@ LocalDate march_31st = LocalDate.ofYearDay(2015, 90);
9997
System.out.println(march_31st); // 2015-03-31
10098
```
10199

102-
The `ofEpochDay` creates LocalDate instance using the epoch day count. The starting value of is `1970-01-01`. So, `LocalDate.ofEpochDay(1)` will give `1970-01-02`.
100+
The `ofEpochDay` creates LocalDate instance using the epoch day count. The starting value of epoch is `1970-01-01`. So, `LocalDate.ofEpochDay(1)` will give `1970-01-02`.
103101

104102
LocalDate instance provide many accessor methods to access different fields like year, month, dayOfWeek, etc.
105103

0 commit comments

Comments
 (0)