Categories | Question details Back To List | ||
dhtmlxscheduler- String to time conversion - How To I have had a play with the scheduler and I can connect and update to and from the mysql database. Now I want to intergrate it into my opensource project myitcrm. The issue is that how can I convert the times in dhtmlxschedular that get parsed to mysql database as a time string eg 12:00pm on the 7th of Oct 2009 get parse to the datasbe as 1254880800 How can i get dhtmlxscheduler to format it's dates to this type of format? BTW - Great code snippet! Answer posted by Stanislav (support) on Oct 07, 2009 01:44 There are two ways a) assuming that you are using connectors you can add any kind of custom formating code as function data_to_str($data){ //from db to client $time = $data->get_value("start_time"); $time = any_custom_conversion($time); $data->set_value("start_time",$time); } function str_to_date($action){ //from client to db $time = $action->get_value("start_time"); $time = any_custom_conversion($time); $action->set_value("start_time",$time); } $sched->event->attach("beforeRender","data_to_str"); $sched->event->attach("beforeProcessing","str_to_date"); Scheduler itself can't parse incoming timestamp, it requires some kind of formatted date. Exact format of date can be specified by scheduler.config.xml_date http://www.dhtmlx.com/dhxdocs/doku.php?id=dhtmlxscheduler:settings |