Riferimento interattivo: testa le stringhe di formato, consulta i parametri e prova le espressioni strtotime().
{{ dateResult }}
<?php echo date("{{ dateFormat }}"); ?>
| {{ __t('th_character') }} | {{ __t('th_description') }} | {{ __t('th_example') }} | |
|---|---|---|---|
| {{ group.title }} | |||
{{ p.char }} |
{{ p.desc }} | {{ getParamExample(p.char) }} | |
{{ strtotimeResult.timestamp }}
{{ strtotimeResult.formatted }}
{{ strtotimeResult.relative }}
{{ strtotimePhpCode }}
| {{ __t('th_expression') }} | {{ __t('th_description') }} | {{ __t('label_result') }} |
|---|---|---|
{{ ref.expr }} |
{{ ref.desc }} | {{ getStrtotimeExample(ref.expr) }} |
La funzione date(string $format, ?int $timestamp = null) formatta un timestamp Unix o l'ora corrente in una stringa leggibile. La stringa di formato è composta da segnaposto come Y (anno a quattro cifre), m (mese con zero iniziale), d (giorno) o H:i:s (ore:minuti:secondi in formato 24h).
strtotime(string $datetime, ?int $baseTimestamp = null) converte descrizioni testuali in inglese in timestamp Unix. Input tipici: "now", "+1 day", "next monday", "first day of next month", "last day of december 2025". La funzione è estremamente flessibile e comprende anche espressioni combinate come "+2 weeks 3 days".
date("Y-m-d") — Data ISO: 2025-03-15date("d.m.Y") — Formato tedesco: 15.03.2025date("Y-m-d H:i:s") — MySQL Datetimedate("c") — ISO 8601: 2025-03-15T14:30:00+01:00date("r") — RFC 2822: Sat, 15 Mar 2025 14:30:00 +0100date("U") — Timestamp Unix