I saw this question which is similar to my question, but however the workaround still gave me an error.
I have an sql query string like this in my .jrxml file
<queryString>
<![CDATA[select sl_no,cast(action_on as date) from action_history]]>
</queryString>
I am using the Eclipse plugin JasperStudio for designing the template and am using PostgreSql for my database. Now this query is fetching data properly as expected.
My action_on is a java.sql.Timestamp type.
<field name="action_on" class="java.sql.Timestamp">
I only want the date like 22/08/15
or 22/08/2015
to be printed and don't want the time to be printed, so when I try casting or using action_on::date
, I get 22/08/15 12:00 AM
printed with the time always 12:00 AM. What perplexes me more is that when I try this command on my terminal , it doesn't give me the time and only the unformatted date!
Is there a workaround for this?
EDIT
I changed <field name="action_on" class="java.sql.Timestamp">
to <field name="action_on" class="java.lang.String">
and I get the date 2015-08-22
!
Is there a way to now format this?