Interaktywna dokumentacja: testuj ciągi formatujące, sprawdzaj parametry i wypróbuj wyrażenia 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) }} |
Funkcja date(string $format, ?int $timestamp = null) formatuje znacznik czasu Unix lub aktualny czas do czytelnego ciągu znaków. Ciąg formatujący składa się z symboli zastępczych, takich jak Y (czterocyfrowy rok), m (miesiąc z zerem wiodącym), d (dzień) lub H:i:s (godziny:minuty:sekundy w formacie 24h).
strtotime(string $datetime, ?int $baseTimestamp = null) konwertuje angielskie opisy tekstowe na znaczniki czasu Unix. Typowe dane wejściowe: "now", "+1 day", "next monday", "first day of next month", "last day of december 2025". Funkcja jest niezwykle elastyczna i rozumie również wyrażenia złożone, takie jak "+2 weeks 3 days".
date("Y-m-d") — Data ISO: 2025-03-15date("d.m.Y") — Format niemiecki: 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") — Znacznik czasu Unix