How to convert a Report's record's date format value into another one


Tinn Aphopchung

Hi, David.

I use PDOExtended class and write php webservice from it.

I have some problem with date format.

if the code like this in example.

And return array as json.And "datein" is datetime field as Y-m-d and time format.

I want to change format to d/m/Y and time.

And show data "datein" in report control.

How can I change datetime format?

which sql query do I need to coding?

thanks. (I spend 1 days but cannot fix it)


DecSoft

Hello tin,

Please, update your App Builder copy. The new sample "Report16" shown how we can use the AngularJS "date" filter inside a Report in order to achieve what you wanted: take certain date formated in some way (timestamp or a format like your own one) and convert it into another date format string.



Tinn Aphopchung

Thanks,David.You choose to change in client side not the server side.
But it same result as I expect. :)


Tinn Aphopchung

oh. I test it.It cannot change format.
because my output from database is "2016-12-30 00:00:00"
It have time in data,then this format code not work.
or I doing something wrong?


DecSoft

Hello tin,

Are you sure there is not a typo on "dateget"? If not, note that we can format a date value from certain format to another: not all possible date formats are supported. Have you the possibility to change the date field with a "timestamp" value? I think this can be the best option, between other things, because we can format a "timestamp" value to other formats, then may this can solve the problem.

Or maybe you can perform (this can be also a good solution) the date forma transformation on the server side, and provide the application with the correct date format values...



DecSoft

Hello tin,

I modify a bit the "Report16" sample to include "hour" information in the date fields, and, apparently they works well. Please, take a look at the attached file and tell me what do you think about tin.

(Modified) Report16.zip


Todo el mundo puede leer el foro de soporte de DecSoft para aprender del mismo, sin embargo, sólo los clientes de DecSoft pueden abrir nuevos hilos. Compre una o más licencias de productos de DecSoft y obtendrá este y otros beneficios.

Este sitio utiliza "cookies" útiles para almacenar sus preferencias.

Bien. Ocultar esta nota. Obtener más información.