Building a TYPO3 extension in Extbase/Fluid

Formatting a DateTime object

TYPO3 uses the PHP DateTime object. This means you can not handle it the classical PHP way:

// NOT WORKING:
strtotime($t3DateObj);
// NOT WORKING:
date('Y-m-d', $t3DateObj);

// WORKING:
$t3DateObj->format('Y-m-d');
$t3DateObj->format('Y-m-d');

for the formatting string see PHP function “date”