Timestamp data types in DB2 are formatted as:
2016-11-22-14.56.18.376000
What is the correct srcformat to get this to display with the datetime picker? Trying this does not work:
$col["formatter"] = "datetime";
$col["formatoptions"] = array("srcformat"=>'Y-m-d-H.i.s',"newformat"=>'Y-m-d H:i',"opts" => array("timeFormat"=>"HH:mm"));
You can try srcformat as Y-m-d-h.i.s.u
I've not tested it, feel free to contact back if it does not work.
source: http://stackoverflow.com/questions/12654051/db2-timestamp-php-datetime
Still not working:
$col["formatter"] = "datetime";
$col["formatoptions"] = array("srcformat"=>'Y-m-d-H.i.s.u',"newformat"=>'Y-m-d-H.i.s.u');
Produces the following results:
2016-12-21-14.02.16.000000 => 0000-12-21-02.16.00.000000
2016-12-21-11.44.01.000000 => blanks
It's interpreting the minutes position as hours, and not interpreting the year at all.
Resolved via email. Pasting for reference.
$sqlCommand = "
select a.*, (substr(char(A.TIME_LM),1,10) concat ' ' concat substr(char(A.TIME_LM),12,8)) time_char , (substr(char(A.TIME_LM),1,10) concat ' ' concat substr(char(A.TIME_LM),12,8)) time_char2
from ……………….
";
$col = array();
$col["name"] = "TIME_CHAR2";
$col["title"] = "Last modified time";
// $col["hidden"] = true;
$col["formatter"] = "datetime";
$col["formatoptions"] = array("srcformat"=>'Y-m-d H.i.s',"newformat"=>'Y-m-d H.i.s');
$col["width"] = 500 ;
$col["dbname"] = "(substr(char(A.TIME_LM),1,10) concat ' ' concat substr(char(A.TIME_LM),12,8))";
$cols[] = $col;