Eine kleines Datum&Uhrzeit Formatierer Skript welches etwa 600 B (minified + gzipped) groß ist.




---
Eine kleines Datum&Uhrzeit Formatierer Skript welches etwa 600 B _(minified + gzipped)_ groß ist.
``javascript`
const du = datumUhrzeit(); // Aktuelles Datum/Zeit
const du2 = datumUhrzeit('2025-12-25'); // Spezifisches Datum
| Methode | Ohne Parameter | Mit Parameter | Beschreibung |
| ----------- | -------------- | --------------------- | --------------------- |
| seconds() | 55 | seconds(2) → "55" | Sekunden |minutes()
| | 32 | minutes(2) → "32" | Minuten |hours()
| | 17 | hours(2) → "17" | Stunden (24h) |day()
| | 0 | day(1) → "0" | Wochentag (0=Sonntag) |date()
| | 28 | date(2) → "28" | Tag des Monats |month()
| | 9 | month(2) → "09" | Monat (1-12) |year()
| | 2025 | year(4) → "2025" | Jahr |
---
`javascript`
du.format('dd.MM.yyyy'); // "28.09.2025"
du.format('EEEE, d. MMMM yyyy'); // "Sonntag, 28. September 2025"
du.format('HH:mm:ss'); // "17:32:55"
| Token | Beispiel | Beschreibung |
| ------ | ----------- | ----------------------- |
| y | 25 | Jahr, 2-stellig |yy
| | 25 | Jahr, 2-stellig |yyyy
| | 2025 | Jahr, 4-stellig |M
| | 9 | Monat |MM
| | 09 | Monat, 2-stellig |MMM
| | Sep | Monat, kurz |MMMM
| | September | Monat, lang |d
| | 28 | Tag |dd
| | 28 | Tag, 2-stellig |H
| | 17 | Stunde (24h) |HH
| | 17 | Stunde (24h), 2-stellig |h
| | 5 | Stunde (12h) |hh
| | 05 | Stunde (12h), 2-stellig |m
| | 32 | Minute |mm
| | 32 | Minute, 2-stellig |s
| | 55 | Sekunde |ss
| | 55 | Sekunde, 2-stellig |E
| | So | Wochentag, kurz |EEEE
| | Sonntag` | Wochentag, lang |