format date in report pdf

Hello,
I insert, in a PDF report application, a field date (from a database) that has the format: yyyy-mm-dd hh:mm:ss. How can I display my date in another format (es. dd/mm/yyyy without hours)? In the fields sheet there are Values format, but they don’t work.
Thank’s !!!
Beatrice

Re: format date in report pdf

Try to use the sc_date_conv in the onLoad event.

sc_date_conv ({field_date},“fmt_input”, “fmt_output”)

Macro for date manipulation/ conversion.

Examples:

Converts the date from “dd/mm/yyyy” format to the “yyyymmdd” format.

{field_date} = sc_date_conv({field_date}, “dd/mm/aaaa”, “aaaammdd”);

Converts the date from the database native format to “dd/mm/yyyy”.

{field_date} = sc_date_conv({field_date}, “db_format”, “dd/mm/aaaa”);

Converts the date from the “dd/mm/yyyy” format to the Database native format.

{field_date} = sc_date_conv({field_date}, “dd/mm/aaaa”, “db_format”);

Where formats (fmt_ input, fmt_output) are expressed using:

a or y - for year
m - for month
d - for day
db_format - for database date format.

Re: format date in report pdf

Thank you victorjamil,

in the pdf record there isn’t onLoad event, then I insered this command

{data_nasc} = sc_date_conv({data_nasc}, “db_format”, “dd/mm/yyyy”);

in onRecord event, but it don’t work, it is unknown.
Also, if I insert the comman in onInit event, the system makes a mistake: undefined offset 0.

Do you help me again, please?

Betrice

Re: format date in report pdf

It must be used in onRecord event.

Test it in the 4.0.029 version.