Format Date

I do have a problem with presenting date. Format of the field is date (from mysql). Value of that field is '2003-04-17' but on the report it shows me 2/23/42. When I changed it to text file I am not able to filter that field.

kaz.zurad_1's picture
Joined: Oct 16 2017 - 8:57am
Last seen: 2 years 4 months ago

4 Answers:

Click on the date field and then in the Properties tab, select the "Text Field" tab. Select "Pattern" and enter "yyyy-MM-dd".

hozawa's picture
126280
Joined: Apr 24 2010 - 4:31pm
Last seen: 2 years 11 months ago

But it is still text formatted. On reports, when I tried to filter by this field i cannot choose, for example, by the range. Only available filters are as for text file, means "like", "equal", "contain", etc. Not like greated that this date, or less, or, range.

kaz.zurad_1's picture
Joined: Oct 16 2017 - 8:57am
Last seen: 2 years 4 months ago

Have you tried 'new SimpleDateFormat'.   I have found that invaluable for date formatting. You don't need to convert the date - which I assume you only did to try to get it to work another way.

new SimpleDateFormat("yyyy-MM-dd").format($F{some_dt})

Works for $P, $V values etc. as well...at least for me. I am using Sybase ASE dates but I presume it should work for most? It is a JAVA function.

djohns2's picture
42
Joined: Jul 9 2013 - 2:32pm
Last seen: 4 years 1 month ago

Right click the Text field that you want to display date field then select field pattern 

From there you can see the types of date fields  available and pick the one that you needed

madhanharish's picture
Joined: Dec 13 2015 - 9:44pm
Last seen: 4 years 7 months ago
Feedback
randomness