DateViewHelper extends AbstractViewHelper uses CompileWithContentArgumentAndRenderStatic

ViewHelper

This class is the implementation of a Fluid ViewHelper.

View this class in the TYPO3 ViewHelper reference: <f:format.date>

Formats an object implementing :php:`\DateTimeInterface`.

Examples

Defaults

::

<f:format.date>{dateObject}</f:format.date>

1980-12-13 Depending on the current date.

Custom date format

::

<f:format.date format="H:i">{dateObject}</f:format.date>

01:23 Depending on the current time.

Relative date with given time

::

<f:format.date format="Y" base="{dateObject}">-1 year</f:format.date>

2016 Assuming dateObject is in 2017.

strtotime string

::

<f:format.date format="d.m.Y - H:i:s">+1 week 2 days 4 hours 2 seconds</f:format.date>

13.12.1980 - 21:03:42 Depending on the current time, see https://www.php.net/manual/function.strtotime.php.

Localized dates using strftime date format

::

<f:format.date format="%d. %B %Y">{dateObject}</f:format.date>

13. Dezember 1980 Depending on the current date and defined locale. In the example you see the 1980-12-13 in a german locale.

Inline notation

::

{f:format.date(date: dateObject)}

1980-12-13 Depending on the value of {dateObject}.

Inline notation (2nd variant)

::

{dateObject -> f:format.date()}

1980-12-13 Depending on the value of {dateObject}.

Table of Contents

Properties

$escapeChildren  : bool
Needed as child node's output can return a DateTime object which can't be escaped

Methods

initializeArguments()  : mixed
Initialize arguments
renderStatic()  : string

Properties

$escapeChildren

Needed as child node's output can return a DateTime object which can't be escaped

protected bool $escapeChildren = false

Methods

initializeArguments()

Initialize arguments

public initializeArguments() : mixed

renderStatic()

public static renderStatic(array<string|int, mixed> $arguments, Closure $renderChildrenClosure, RenderingContextInterface $renderingContext) : string
Parameters
$arguments : array<string|int, mixed>
$renderChildrenClosure : Closure
$renderingContext : RenderingContextInterface
Tags
throws
Exception
Return values
string

        
On this page

Search results