TYPO3 CMS  TYPO3_6-2
DateViewHelper.php
Go to the documentation of this file.
1 <?php
3 
4 /* *
5  * This script is backported from the TYPO3 Flow package "TYPO3.Fluid". *
6  * *
7  * It is free software; you can redistribute it and/or modify it under *
8  * the terms of the GNU Lesser General Public License, either version 3 *
9  * of the License, or (at your option) any later version. *
10  * *
11  * The TYPO3 project - inspiring people to share! *
12  * */
14 
71 
75  protected $escapingInterceptorEnabled = FALSE;
76 
86  public function render($date = NULL, $format = '') {
87  if ($format === '') {
88  $format = $GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'] ?: 'Y-m-d';
89  }
90 
91  if ($date === NULL) {
92  $date = $this->renderChildren();
93  if ($date === NULL) {
94  return '';
95  }
96  }
97  if (!$date instanceof \DateTime) {
98  try {
100  $date = new \DateTime('@' . $date);
101  } else {
102  $date = new \DateTime($date);
103  }
104  $date->setTimezone(new \DateTimeZone(date_default_timezone_get()));
105  } catch (\Exception $exception) {
106  throw new \TYPO3\CMS\Fluid\Core\ViewHelper\Exception('"' . $date . '" could not be parsed by \DateTime constructor.', 1241722579);
107  }
108  }
109 
110  if (strpos($format, '%') !== FALSE) {
111  return strftime($format, $date->format('U'));
112  } else {
113  return $date->format($format);
114  }
115 
116  }
117 }
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]