class DateViewHelper extends AbstractLocaleAwareViewHelper (View source)

Formats a \DateTime object.

= Examples =

{dateObject} ``` 1980-12-13 (depending on the current date) {dateObject} ``` 01:23 (depending on the current time) +1 week 2 days 4 hours 2 seconds ``` 13.12.1980 - 21:03:42 (depending on the current time, see http://www.php.net/manual/en/function.strtotime.php) @{someTimestamp} ``` 13.12.1980 - 21:03:42 (depending on the current time. Don't forget the "@" in front of the timestamp see http://www.php.net/manual/en/function.strtotime.php) {f:format.date(date: dateObject)} ``` 1980-12-13 (depending on the value of {dateObject}) {dateObject -> f:format.date()} ``` 1980-12-13 (depending on the value of {dateObject}) {dateObject -> f:format.date(localeFormatType: 'date', forceLocale: true)} ``` 13.12.1980 (depending on the value of {dateObject} and the current locale) {dateObject -> f:format.date(forceLocale: 'de_DE')} ``` 13.12.1980 11:15:42 (depending on the value of {dateObject})

Properties

protected ControllerContext $controllerContext

Controller Context to use

from  AbstractViewHelper
protected ObjectManagerInterface $objectManager from  AbstractViewHelper
protected LoggerInterface $logger from  AbstractViewHelper
protected Service $localizationService from  AbstractLocaleAwareViewHelper
protected bool $escapeChildren
protected DatetimeFormatter $datetimeFormatter

Methods

void
setRenderingContext(RenderingContextInterface $renderingContext)

No description

void
injectObjectManager(ObjectManagerInterface $objectManager)

No description

void
injectLogger(LoggerInterface $logger)

Injects the (system) logger based on PSR-3.

injectLocalizationService(Service $localizationService)

No description

getLocale()

Get the locale to use for all locale specific functionality.

void
initializeArguments()

Initialize the arguments.

string
render()

Render the supplied DateTime object as a formatted date.

Details

void setRenderingContext(RenderingContextInterface $renderingContext)

No description

Parameters

RenderingContextInterface $renderingContext

Return Value

void

void injectObjectManager(ObjectManagerInterface $objectManager)

No description

Parameters

ObjectManagerInterface $objectManager

Return Value

void

void injectLogger(LoggerInterface $logger)

Injects the (system) logger based on PSR-3.

Parameters

LoggerInterface $logger

Return Value

void

bool isEscapingInterceptorEnabled()

No description

Return Value

bool

__construct()

Constructor

injectLocalizationService(Service $localizationService)

No description

Parameters

Service $localizationService

protected Locale getLocale()

Get the locale to use for all locale specific functionality.

Return Value

Locale

The locale to use or NULL if locale should not be used

Exceptions

InvalidVariableException

void initializeArguments()

Initialize the arguments.

Return Value

void

string render()

Render the supplied DateTime object as a formatted date.

Return Value

string

Formatted date

Exceptions

Exception