@@ -2,9 +2,9 @@
|
|||||||
Drei verschiedene Klassen für Datum, Zeit und Datum mit Zeit.
|
Drei verschiedene Klassen für Datum, Zeit und Datum mit Zeit.
|
||||||
|
|
||||||
```
|
```
|
||||||
LocalDate date = LocalDate.of(2020, Month.APRIL, 14);
|
LocalDate date = LocalDate.of(2020, Month.APRIL, 14); // Datum ohne Uhrzeit
|
||||||
LocalTime time = LocalTime.of(12, 45);
|
LocalTime time = LocalTime.of(12, 45); // Uhrzeit ohne Datum
|
||||||
LocalDateTime dateTime = LocalDateTime.of(date, time);
|
LocalDateTime dateTime = LocalDateTime.of(date, time); // Datum mit Uhrzeit
|
||||||
```
|
```
|
||||||
|
|
||||||
## Wichtige Eigenschaften
|
## Wichtige Eigenschaften
|
||||||
@@ -14,4 +14,7 @@ LocalDateTime dateTime = LocalDateTime.of(date, time);
|
|||||||
## Formatierte Ausgabe
|
## Formatierte Ausgabe
|
||||||
- Formatierung per `DateTimeFormatter`
|
- Formatierung per `DateTimeFormatter`
|
||||||
- Erzeugung per Factory (`DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofLocalizedDate(FormatStyle.MEDIUM)`
|
- Erzeugung per Factory (`DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofLocalizedDate(FormatStyle.MEDIUM)`
|
||||||
|
- Formatierte Ausgebe: `dateTimeFormatter.format(date)`
|
||||||
|
- Ein Formatter für alle Typen
|
||||||
|
- **Vorsicht**: Bei Verwendung unbekannter Felder `UnsupportedTemporalTypeException`
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user