Building a TYPO3 extension in Extbase/Fluid

Formatting an instance of TYPO3’s very own \Datetime object

TYPO3 uses its own Datetime object. Obviously the developers found timestamps or standard time strings too boring. It was just a lucky try that lead me to the solution.

// 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”