Extbase - Timestamp nutzen
Aus Wikizone
Version vom 26. Juni 2015, 17:01 Uhr von 37.49.33.84 (Diskussion) (Die Seite wurde neu angelegt: „<syntaxhighlight lang="typoscript"> $TCA['tx_myext_domain_model_mymodel']['columns']['crdate'] = Array ( 'exclude' => 1, 'label' => 'Cr…“)
$TCA['tx_myext_domain_model_mymodel']['columns']['crdate'] = Array (
'exclude' => 1,
'label' => 'Creation date',
'config' => Array (
'type' => 'none',
'format' => 'date',
'eval' => 'date',
));
das model erweitern um ein DateTime property und entsprechende getter und setter methoden.
/**
* crdate
*
* @var string
*/
protected $crdate;
/**
* Returns the crdate
*
* @return string $crdate
*/
public function getCrdate() {
return $this->crdate;
}
/**
* Sets the crdate
*
* @param string $crdate
* @return void
*/
public function setCrdate($crdate) {
$this->crdate = $crdate;
}
ausschlaggebend ist zuerst das tca. was dort nicht enthalten ist, wird auch nicht in das model gemappt.
So lässt sich das Datum in Fluid noch ordentlich formatiert ausgeben:
<f:format.date format="d.m.Y - H:i">{firma.tstamp}</f:format.date> Uhr
Vorsicht - scheinbar nutzt der View Helper immer gmt. D.h. die Uhr geht 1h falsch bei uns.