render_sql and from_unixtime

Hi,



everytime, would like to change the given unix-time from the data-base into an readable format, but i even fail with the sql request



<?php

    require_once("…/…/…/opt/dhtmlx_connector/config.php");

    $res=mysql_connect($mysql_server,$mysql_user,$mysql_pass);

    mysql_select_db($mysql_db);



    require("…/…/…/opt/dhtmlx_connector/grid_connector.php");

    $grid = new GridConnector($res);

    #$grid->enable_log(“temp.log”,true);

    $grid->dynamic_loading(50);

    #$grid->render_table(“crm_data”,“id”,“id,company,street,zipcode,city,email,phone,fax”);

    $grid->render_sql(“SELECT *, FROM_UNIXTIME(date_start, ‘%d.%m.%Y - %H:%i:%s’) AS date1 FROM child_free_course”, “id”,“id,date1,date2,title,content”);

?>





Sorry for my english.



Best regards

Florian Banowski from Germany

You can try to use, the code similar to next

function format_dates($data){
$start = strtotime( $data->get_value(“date1”)); //get value from DB
$data->set_value(“date1”,date("%d.%m.%Y - %H:%i:%s",$start));
}
$grid->attachEvent(“beforeRender”,“format_dates”);
$grid->render_sql(“SELECT *, date_start AS date1 FROM child_free_course”, “id”,“id,date1,date2,title,content”);

hi, thanks for answer, but with attachEvent i have a fatal error: GridConnector::attachEvent()

Sorry for inconvenience, it was a typo from my side, the correct code will be

$grid->event->attach(“beforeRender”,“format_dates”);