Skip to content

Commit

Permalink
[TASK] Improve stdWrap.formattedDate
Browse files Browse the repository at this point in the history
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
  • Loading branch information
brotkrueml committed Sep 24, 2024
1 parent 16cf4c0 commit 36f26b3
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion Documentation/Functions/Stdwrap.rst
Original file line number Diff line number Diff line change
Expand Up @@ -910,7 +910,7 @@ formattedDate
.locale
A locale other than the locale of the site language.

.. rubric:: Examples
.. rubric:: Example: Full German output from a date/time value

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

.. rubric:: Example: Full French output from a relative date value

.. code-block:: typoscript
:caption: EXT:site_package/Configuration/TypoScript/setup.typoscript
Expand All @@ -937,6 +939,19 @@ formattedDate
will result in "dimanche 12 mars 2023 à 11:16:44 heure d’été du Pacifique".

.. rubric:: Example: Custom format from a timestamp

.. code-block:: typoscript
:caption: EXT:site_package/Configuration/TypoScript/setup.typoscript
lib.my_formatted_date = TEXT
lib.my_formatted_date {
value = 1679022000
formattedDate = Y-MM-dd'T'HH:mm:ssZ
}
will return the date in the ISO 8601 format: "2023-03-17T03:00:00+00:00"

.. note::
The timezone will be taken from the setting `date.timezone` in your
:file:`php.ini`.
Expand Down

0 comments on commit 36f26b3

Please sign in to comment.