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,
]
]
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,
]
]
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¶
Note
New in version 12.0.
TYPO3 automatically creates database fields for all TCA type
datetime
columns, if those are not already manually
defined in the corresponding extensions' ext_tables.sql
file.
Note
TYPO3 does not handle the following dates properly:
Before Christ (negative year)
double-digit years