Reputation: 123
Assuming the following Typo3 RealURL setup:
'news' => array(
array(
'GETvar' => 'tx_news_pi1[action]',
),
array(
'GETvar' => 'tx_news_pi1[controller]',
),
array(
'GETvar' => 'tx_news_pi1[news]',
'lookUpTable' => array(
'table' => 'tx_news_domain_model_news',
'id_field' => 'uid',
'alias_field' => 'CONCAT(title, "-", datetime)',
'addWhereClause' => ' AND NOT deleted',
'useUniqueCache' => 1,
'useUniqueCache_conf' => array(
'strtolower' => 1,
'spaceCharacter' => '-',
),
'languageGetVar' => 'L',
'languageExceptionUids' => '',
'languageField' => 'sys_language_uid',
'transOrigPointerField' => 'l10n_parent',
'autoUpdate' => 1,
'expireDays' => 180,
),
),
),
It's about this line: 'alias_field' => 'CONCAT(title, "-", datetime)',
I need to format the timestamp.
What I already tried: 'alias_field' => 'CONCAT(title, "-", DATE_FORMAT(datetime, '%Y-%m-%d'))',
+++ some more text +++ some more text +++ some more text +++
Upvotes: 1
Views: 461
Reputation: 9671
You need to use the MySQL date formatting functions:
'alias_field' => 'CONCAT(title, "-", DATE(FROM_UNIXTIME(datetime)))',
This will convert the Unix timestamp to a MySQL DateTime and format it as date only.
See the Date and Time functions of MySQL for more information.
Upvotes: 2