Skip to content

Commit b51e989

Browse files
authored
[TASK] Improve stdWrap.formattedDate (#1344)
An example for a custom date/time format derived from a timestamp has been added. Additionally, add a heading for each example to improve readability. Releases: main, 12.4
1 parent 16cf4c0 commit b51e989

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

Documentation/Functions/Stdwrap.rst

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -910,7 +910,7 @@ formattedDate
910910
.locale
911911
A locale other than the locale of the site language.
912912

913-
.. rubric:: Examples
913+
.. rubric:: Example: Full German output from a date/time value
914914

915915
.. code-block:: typoscript
916916
:caption: EXT:site_package/Configuration/TypoScript/setup.typoscript
@@ -925,6 +925,8 @@ formattedDate
925925
926926
will result in "Freitag, 17. März 2023 um 03:00:00 Nordamerikanische Westküsten-Sommerzeit".
927927

928+
.. rubric:: Example: Full French output from a relative date value
929+
928930
.. code-block:: typoscript
929931
:caption: EXT:site_package/Configuration/TypoScript/setup.typoscript
930932
@@ -937,6 +939,19 @@ formattedDate
937939
938940
will result in "dimanche 12 mars 2023 à 11:16:44 heure d’été du Pacifique".
939941

942+
.. rubric:: Example: Custom format from a timestamp
943+
944+
.. code-block:: typoscript
945+
:caption: EXT:site_package/Configuration/TypoScript/setup.typoscript
946+
947+
lib.my_formatted_date = TEXT
948+
lib.my_formatted_date {
949+
value = 1679022000
950+
formattedDate = Y-MM-dd'T'HH:mm:ssZ
951+
}
952+
953+
will return the date in the ISO 8601 format: "2023-03-17T03:00:00+00:00"
954+
940955
.. note::
941956
The timezone will be taken from the setting `date.timezone` in your
942957
:file:`php.ini`.

0 commit comments

Comments
 (0)