Datetime

New in version 12.0

The TCA type datetime has been introduced. It replaces the renderType=inputDateTime of TCA type input.

When using the datetime type, TYPO3 takes care of generating the according database field. A developer does not need to define this field in an extension's ext_tables.sql file.

The TCA type datetime should be used to input values representing a date time or datetime.

Example

A simple date field, stored as int in the database:

'a_datetime_field' => [
    'label' => 'Datetime field',
    'config' => [
        'type' => 'datetime',
        'format' => 'date',
        'eval' => 'int',
        'default' => 0,
    ]
]
Copied!

Migration

A complete migration from renderType=inputDateTime to type=datetime looks like the following:

 // Before

 'a_datetime_field' => [
     'label' => 'Datetime field',
     'config' => [
         'type' => 'input',
         'renderType' => 'inputDateTime',
         'required' => true,
         'size' => 20,
         'max' => 1024,
         'eval' => 'date,int',
         'default' => 0,
     ],
 ],

// After

 'a_datetime_field' => [
     'label' => 'Datetime field',
     'config' => [
         'type' => 'datetime',
         'format' => 'date',
         'required' => true,
         'size' => 20,
         'default' => 0,
     ]
 ]
Copied!

An automatic TCA migration is performed on the fly, migrating all occurrences to the new TCA type and triggering a PHP E_USER_DEPRECATED error where code adoption has to take place.

Notes