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.

Changed in version 13.0

The database type has changed from int signed to bigint signed when the field is auto-generated (with the exception of the columns tstamp, crdate, starttime, endtime that still use int signed). This allows to store dates from some million years ago to far into the future.

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

Example

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

'a_datetime_field' => [
    'label' => 'Datetime field',
    'config' => [
        'type' => 'datetime',
        'format' => 'date',
        '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