@@ -2,9 +2,9 @@
|
||||
Drei verschiedene Klassen für Datum, Zeit und Datum mit Zeit.
|
||||
|
||||
```
|
||||
LocalDate date = LocalDate.of(2020, Month.APRIL, 14);
|
||||
LocalTime time = LocalTime.of(12, 45);
|
||||
LocalDateTime dateTime = LocalDateTime.of(date, time);
|
||||
LocalDate date = LocalDate.of(2020, Month.APRIL, 14); // Datum ohne Uhrzeit
|
||||
LocalTime time = LocalTime.of(12, 45); // Uhrzeit ohne Datum
|
||||
LocalDateTime dateTime = LocalDateTime.of(date, time); // Datum mit Uhrzeit
|
||||
```
|
||||
|
||||
## Wichtige Eigenschaften
|
||||
@@ -14,4 +14,7 @@ LocalDateTime dateTime = LocalDateTime.of(date, time);
|
||||
## Formatierte Ausgabe
|
||||
- Formatierung per `DateTimeFormatter`
|
||||
- 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