Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions concepts/datetime/.meta/config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"blurb": "There are several classes in Java to work with dates and time.",
"authors": ["sanderploegsma"],
"contributors": []
"authors": [
"sanderploegsma"
],
"contributors": [
"kahgoh"
]
}
11 changes: 11 additions & 0 deletions concepts/datetime/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,18 @@ printer.format(date);
// => "December 3, 2007"
```

A [locale][locale] can also be specified when creating the custom format to format and parse for different regions:

```java
DateTimeFormatter.ofPattern("MMMM d, yyyy", Locale.FRENCH).format(date);
// => décembre 3, 2007

DateTimeFormatter.ofPattern("MMMM d, yyyy", Locale.of("pt")).format(date);
// => dezembro 3, 2007
```

[iso-8601]: https://en.wikipedia.org/wiki/ISO_8601
[localdate-docs]: https://docs.oracle.com/javase/8/docs/api/java/time/LocalDate.html
[localdatetime-docs]: https://docs.oracle.com/javase/8/docs/api/java/time/LocalDateTime.html
[locale]: https://docs.oracle.com/javase/8/docs/api/java/util/Locale.html
[datetimeformatter-docs]: https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html
10 changes: 10 additions & 0 deletions concepts/datetime/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,14 @@ printer.format(date);
// => "December 3, 2007"
```

A locale can also be specified when creating the custom format to format and parse for different regions:

```java
DateTimeFormatter.ofPattern("MMMM d, yyyy", Locale.FRENCH).format(date);
// => décembre 3, 2007

DateTimeFormatter.ofPattern("MMMM d, yyyy", Locale.of("pt")).format(date);
// => dezembro 3, 2007
```

[iso-8601]: https://en.wikipedia.org/wiki/ISO_8601
10 changes: 10 additions & 0 deletions exercises/concept/booking-up-for-beauty/.docs/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,14 @@ printer.format(date);
// => "December 3, 2007"
```

A locale can also be specified when creating the custom format to format and parse for different regions:

```java
DateTimeFormatter.ofPattern("MMMM d, yyyy", Locale.FRENCH).format(date);
// => décembre 3, 2007

DateTimeFormatter.ofPattern("MMMM d, yyyy", Locale.of("pt")).format(date);
// => dezembro 3, 2007
```

[iso-8601]: https://en.wikipedia.org/wiki/ISO_8601