Formatting a datetime field

Stimulsoft Reports.Flex discussion
Locked
Vyccus
Posts: 14
Joined: Tue Jul 24, 2012 11:38 am

Formatting a datetime field

Post 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
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Formatting a datetime field

Post 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.
Vyccus
Posts: 14
Joined: Tue Jul 24, 2012 11:38 am

Re: Formatting a datetime field

Post 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
Attachments
Relatório.mrt
(21.84 KiB) Downloaded 631 times
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Formatting a datetime field

Post 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.
Vyccus
Posts: 14
Joined: Tue Jul 24, 2012 11:38 am

Re: Formatting a datetime field

Post 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?
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Formatting a datetime field

Post 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.
Vyccus
Posts: 14
Joined: Tue Jul 24, 2012 11:38 am

Re: Formatting a datetime field

Post 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?
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Formatting a datetime field

Post 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.
Vyccus
Posts: 14
Joined: Tue Jul 24, 2012 11:38 am

Re: Formatting a datetime field

Post by Vyccus »

Doesn't work at all
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Formatting a datetime field

Post 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.
Locked