Implemented a basic date view helper
[Packages/TYPO3.CMS.git] / typo3 / sysext / fluid / Classes / ViewHelpers / Format / DateViewHelper.php
1 <?php
2
3 /* *
4 * This script is part of the TYPO3 project - inspiring people to share! *
5 * *
6 * TYPO3 is free software; you can redistribute it and/or modify it under *
7 * the terms of the GNU General Public License version 2 as published by *
8 * the Free Software Foundation. *
9 * *
10 * This script is distributed in the hope that it will be useful, but *
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- *
12 * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General *
13 * Public License for more details. *
14 * */
15
16 /**
17 * A simple date format view helper.
18 *
19 * @package
20 * @subpackage
21 * @version $Id:$
22 */
23 class Tx_Fluid_ViewHelpers_Format_DateViewHelper extends Tx_Fluid_Core_AbstractViewHelper {
24 /**
25 * Render the supplied DateTime object as a formatted date.
26 *
27 * @param string $format The date format in date() syntax
28 * @param DateTime $value The DateTime object to format
29 * @return string Formatted date
30 * @author Christopher Hlubek <hlubek@networkteam.com>
31 */
32 public function render($value, $format = 'Y-m-d H:i') {
33 $formattedDate = '';
34 if ($value != NULL) {
35 $formattedDate = $value->format($format);
36 }
37 return $formattedDate;
38 }
39 }
40
41
42 ?>