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
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:
And the php function content should be:
Best regards,
Max
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
Thanks Max,
This work perfectly with a list in a table but in a "Details List" I tried to insert in the "Filed View":
and the php function:
and also
but the doesn't work, any suggestion about the php function for a "Details List"
Thanks again
Francesco
This work perfectly with a list in a table but in a "Details List" I tried to insert in the "Filed View":
{fn:php_fn_name}
and the php function:
echo date("d/m/Y", strtotime($this->get("table_view_name.Model.field")))
and also
echo date("d/m/Y", strtotime($this->get("Model.field")))
but the doesn't work, any suggestion about the php function for a "Details List"
Thanks again
Francesco
Hi Francesco,
In a details view its easier, you can call the value from the data read var directly like this:
or
Best regards,
Max
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
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
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:
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
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
Hooray just did this in a faster / easier way.
Let's say your model is called Model.
Let's say your date field is called created, and your table view has a column in the column list called "Model.created:Created"
Let's say your table view is called table1.
In your table view, under Columns views, just put in
Let's say your model is called Model.
Let's say your date field is called created, and your table view has a column in the column list called "Model.created:Created"
Let's say your table view is called table1.
In your table view, under Columns views, just put in
Model.created:{date:d-m-Y$(var:table1.row.Model.created)}replacing d-m-Y with whatever format string you needed.
On a details view you still need to use row, as in {var:details_list.row.model.field}
This topic is locked and no more replies can be posted.