[Typo3] date as label-field shows seconds sinds epoch instead of formatted date

Pieter Jelle pieter.jelle at invalid.invalid
Tue May 31 03:50:13 CEST 2005


Christopher wrote:
> Hi,
> 
> On 5/30/05, Pieter Jelle <pieter.jelle at invalid.invalid> wrote:
> 
>>Hello all
>>
>>An extension I've written myself for a theatre uses a date record to
>>represent the playing dates of a certain show, and these date records
>>are linked to a show record. However, I use the date field (which is the
>>only field for this record) as the label field for the backend, but in
>>the backend these records are listed as seconds since the epoch (which
>>is the way the record is stored in the database) instead of a formatted
>>date. See http://statik.be/misc/shows.gif for an example.
>>
>>For the people using the backend of course this is rather confusing, and
>>I would like a formatted date to be shown, and have been looking in the
>>Typo3 source to change this myself but couldn't find a way to do this.
>>Can anyone suggest where and what to change to get this to show
>>correctly or has anyone got another idea? Thanks in advance!
>>
>>(I have searched the archives and found this problem being mentioned,
>>but no solution.)
>>
> 
> 
> I think what you need is the API doc [1]. See 'eval' and 'checkbox' in
> part 4.2.5 ['columns'][fieldname]['config'] / TYPE: "input" of the TCA
> section [2].

I checked those, but those were set correctly in tca.php of my 
extension. However, after an hour of digging in the source, I finally 
fixed it by adding a switch to the function getRecordTitle in 
class.t3lib_befunc.php. Just before the return $t I added this piece of 
code :

$eval = 
$TCA[$table]['columns'][$TCA[$table]['ctrl']['label']]['config']['eval'];
switch($eval) {
	case 'date':
		$t = date("j-n-Y", $t);
	break;
	default:
	break;
}


it can be extended with other eval types which need special treatment, 
but this works fine for me. Hope this is helpful to someone with the 
same problem.

Regards
PJ



More information about the TYPO3-english mailing list