Hi,
I would format date-time extract from a db table, from yyyy-mm-dd to dd-mm-yyyy. I test using "Modify Data" function with the following parameters:
Name: modify_data
Data Provider: {data:read_dbTable}
Var Name: {Model.TableField}
Data override: return date("d/m/Y");
the parameters "Select type" of read_dbTable function are is "All matching records."
I call also the function in the event "index" but the date format is not modified.
Could you help me please?
Francesco
Hi Francesco,
The modify data function can not help here, you need a php function.
The syntax depends on where the php function is called and from where do you get the date value.
For example, if you are listing the data inside a table, then the php function should be called inside the "Columns views" of your table like this:
{fn:php_fn_name}
And the php function content should be:
echo date("d/m/Y", strtotime($this->get("table_view_name.row.Model.field")));
Best regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
Hi Francesco,
In a details view its easier, you can call the value from the data read var directly like this:
echo date("d/m/Y", strtotime($this->get("read_data_fn_name.Model.field")))
or
echo date("d/m/Y", strtotime($this->get("details_view_name.row.field")))
Best regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
Hi Max,
These codes don't work for me. I tested both.... Here the screenshot of the details view. where is the error?
Thanks again
Francesco
Hi Francesco,
The PHP code in the php function is what should be changed, and you should call the php function in the details view, you can not run php code in the details view as you have now.
So you may need this line in the details view:
Gara.data_gara:{fn:php_fn_name}
And the line I sent before in the php function.
Please let me know if you still can't get this done.
Best regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
On a details view you still need to use row, as in {var:details_list.row.model.field}