I have to convert a timestamp column to date (format d-m-Y H:i:s).
I used the delegate class and the script works but... instead to display 2012 it displays 2038!
This is the code:
- Code: Select all
class tables_pagine {
function ts__display(&$record){
$ts = (int)$record->strval('ts');
return date('d-m-Y H:i:s', $ts);
}
}
This is what stored in the mysql timestamp column:
- Code: Select all
2012-05-18 13:41:18
... And this is the result in the view:
- Code: Select all
19-01-2038 04:14:07
I tried without forcing the cast and the result in the view is:
- Code: Select all
10-07-1925 02:52:38
This is the environment:
PHP: 5.3.8
Mysql: 5.5.16
Hoping someone of you can help.