Page 1 of 1

Formatting a datetime field

Posted: Tue Jul 24, 2012 12:19 pm
by Vyccus
I'm trying to display a field of datetime and I'm having some trouble formatting this.

I want something like that:

dd/MM/yyyy HH:mm

And I'm getting this when my field is not null:

Mon Jul 23...

And when my field is null:

NaN/NaN/NaN...

I've already tried the "Text Format" property, but it just don't work properly as well, maybe because it isn't a text property, I don't know.

How can I set the Date Format properly and how can I avoid the "NaN/NaN/NaN" stuff

Re: Formatting a datetime field

Posted: Tue Jul 24, 2012 1:41 pm
by HighAley
Hello.

You could format with TextFormat property DateTime type fields only. Also you could set format with next expression:

Code: Select all

 {DataSource1.DateTimeColumn.ToString("dd/MM/yyyy HH:mm")}
If it will not help you, please, send us a report template with data for analysis.

Thank you.

Re: Formatting a datetime field

Posted: Tue Jul 24, 2012 2:02 pm
by Vyccus
Hello mate, thanks for your reply.
I tried what you've suggested and it didn't work, I'll upload my layout.

cheers

Re: Formatting a datetime field

Posted: Wed Jul 25, 2012 7:52 am
by HighAley
Hello.

You didn't send us any data for report.
Where do you have problems? Please, describe your problem. How to reproduce it?

Thank you.

Re: Formatting a datetime field

Posted: Wed Jul 25, 2012 11:24 am
by Vyccus
Thank you for your reply.

My problem is regarding the date field (ultimoLogon), when I change the text format this field is printed with "0" and when I change only the field type to "datetime" it's printed as I've mentioned on my original post.

About the data, I don't know how I can put my data here, because it's just some string fields and one problematic date field.

I just want something to format it with this pattern: dd/MM/yyyy HH:mm. Is there another way to do that, besides using this one that you already mentioned?

Re: Formatting a datetime field

Posted: Wed Jul 25, 2012 1:33 pm
by HighAley
Hello.

Please, try to set Hide Zeros property of the Text9 component to True.

By the way, the ultimoLogon column type is string in the report template that you send us.

Thank you.

Re: Formatting a datetime field

Posted: Wed Jul 25, 2012 1:42 pm
by Vyccus
Yeap, I did change to send to you guys.
If I set the "Hide Zeros" to true, it won't solve the problem, because even the fields with a date to be printed are printing zeros.

Any idea?

Re: Formatting a datetime field

Posted: Wed Jul 25, 2012 2:27 pm
by HighAley
Hello.

To avoid displaying zeros you should change expression like next:

Code: Select all

{IIF(dados.ultimoLogon == null , "", dados.ultimoLogon.ToString("dd/MM/yyyy HH:mm"))}
Thank you.

Re: Formatting a datetime field

Posted: Wed Jul 25, 2012 4:24 pm
by Vyccus
Doesn't work at all

Re: Formatting a datetime field

Posted: Thu Jul 26, 2012 12:19 pm
by HighAley
Hello.

Please, send us the right report template with data for analysis.
And describe issue that you have now more detailed.

Thank you.