Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
seljabali committed Feb 26, 2024
1 parent 1fd88a5 commit 6dc82a6
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,20 @@
[Java Time](https://docs.oracle.com/javase/8/docs/api/java/time/package-summary.html), released in Java 8, was a huge improvement over its [Date](https://docs.oracle.com/javase/8/docs/api/java/sql/Date.html) predecessor.<br><br>
This library empowers Java Time & makes it a lot of **fun**! 😃

```diff
- val dateTimeFormatter = DateTimeFormatter.ofPattern("yyyyMMdd")
- val date = LocalDate.parse(dateText, dateTimeFormatter)
+ val date = dateText.toLocalDate("yyyyMMdd")


- val dateFormatter = DateTimeFormatter.ofPattern("MM/dd/yyyy")
- println(dateFormatter.format(date))
+ println(date.print("MM/dd/yyyy"))

- if (ChronoUnit.YEARS.between(dateOfBirth, LocalDate.now()) < 18) {
+ if (dateOfBirth.getYearDifference(LocalDates.today) < 18) {
```

## What's In It?
#### 1. Parsing
```kotlin
Expand Down

0 comments on commit 6dc82a6

Please sign in to comment.