TYPO3  7.6
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
DateViewHelper Class Reference
Inheritance diagram for DateViewHelper:
AbstractViewHelper CompilableInterface

Public Member Functions

 render ($date=null, $format= '', $base=null)
 
- Public Member Functions inherited from AbstractViewHelper
 setArguments (array $arguments)
 
 setRenderingContext (\TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface $renderingContext)
 
 injectReflectionService (\TYPO3\CMS\Extbase\Reflection\ReflectionService $reflectionService)
 
 isEscapingInterceptorEnabled ()
 
 setViewHelperNode (\TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\ViewHelperNode $node)
 
 setRenderChildrenClosure (\Closure $renderChildrenClosure)
 
 initializeArgumentsAndRender ()
 
 initialize ()
 
 renderChildren ()
 
 prepareArguments ()
 
 validateArguments ()
 
 initializeArguments ()
 
 compile ($argumentsVariableName, $renderChildrenClosureVariableName, &$initializationPhpCode,\TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\AbstractNode $syntaxTreeNode,\TYPO3\CMS\Fluid\Core\Compiler\TemplateCompiler $templateCompiler)
 
 resetState ()
 
- Public Member Functions inherited from CompilableInterface
 compile ($argumentsVariableName, $renderChildrenClosureVariableName, &$initializationPhpCode,\TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\AbstractNode $syntaxTreeNode,\TYPO3\CMS\Fluid\Core\Compiler\TemplateCompiler $templateCompiler)
 

Static Public Member Functions

static renderStatic (array $arguments,\Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
 
- Static Public Member Functions inherited from AbstractViewHelper
static renderStatic (array $arguments,\Closure $renderChildrenClosure,\TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface $renderingContext)
 
- Static Public Member Functions inherited from CompilableInterface
static renderStatic (array $arguments,\Closure $renderChildrenClosure,\TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface $renderingContext)
 

Protected Attributes

 $escapingInterceptorEnabled = false
 
- Protected Attributes inherited from AbstractViewHelper
 $arguments
 
 $templateVariableContainer
 
 $controllerContext
 
 $renderingContext
 
 $renderChildrenClosure = null
 
 $viewHelperVariableContainer
 
 $objectManager
 
 $escapingInterceptorEnabled = true
 

Additional Inherited Members

- Protected Member Functions inherited from AbstractViewHelper
 registerArgument ($name, $type, $description, $required=false, $defaultValue=null)
 
 overrideArgument ($name, $type, $description, $required=false, $defaultValue=null)
 
 callRenderMethod ()
 
 getLogger ()
 
 buildRenderChildrenClosure ()
 
 hasArgument ($argumentName)
 

Detailed Description

Formats a object.

= Examples =

<f:format.date>{dateObject}</f:format.date> <output> 1980-12-13 (depending on the current date) </output>

<f:format.date format="H:i">{dateObject}</f:format.date> <output> 01:23 (depending on the current time) </output>

<f:format.date format="Y" base="{dateObject}">-1 year</f:format.date> <output> 2016 (assuming dateObject is in 2017) </output>

<f:format.date format="d.m.Y - H:i:s">+1 week 2 days 4 hours 2 seconds</f:format.date> <output> 13.12.1980 - 21:03:42 (depending on the current time, see http://www.php.net/manual/en/function.strtotime.php) </output>

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

  1. Dezember 1980 (depending on the current date and defined locale. In the example you see the 1980-12-13 in a german locale) </output>

{f:format.date(date: dateObject)} <output> 1980-12-13 (depending on the value of {dateObject}) </output>

{dateObject -> f:format.date()} <output> 1980-12-13 (depending on the value of {dateObject}) </output>

Definition at line 83 of file DateViewHelper.php.

Member Function Documentation

render (   $date = null,
  $format = '',
  $base = null 
)

Render the supplied DateTime object as a formatted date.

Parameters
mixed$dateeither a DateTime object or a string that is accepted by DateTime constructor
string$formatFormat String which is taken to format the Date/Time
mixed$baseA base time (a DateTime object or a string) used if $date is a relative date specification. Defaults to current time.
Returns
string Formatted date
Exceptions
Exception

Definition at line 101 of file DateViewHelper.php.

References AbstractViewHelper\buildRenderChildrenClosure().

static renderStatic ( array  $arguments,
\Closure  $renderChildrenClosure,
RenderingContextInterface  $renderingContext 
)
static
Parameters
array$arguments
\Closure$renderChildrenClosure
RenderingContextInterface$renderingContext
Returns
string
Exceptions
Exception

Definition at line 122 of file DateViewHelper.php.

References $GLOBALS, AbstractViewHelper\$renderChildrenClosure, and MathUtility\canBeInterpretedAsInteger().

Member Data Documentation

$escapingInterceptorEnabled = false
protected

Definition at line 88 of file DateViewHelper.php.