Jump to content

Incompatible Date format passed from Calen.control


_garfield_

Recommended Posts

Hi All

 

Im having a problem passing dates to the jasper report.

ive tried allmost everything to fix this.

 

I changed the parameter in the jasper report to date and then in the sql tried to reformat the date to what i want it to be.

 

is there anyway that i can change the format of the date to yyyy-mm-dd in jasperserver for the Calendar Control?

 

Any help would be very much appreciated.

 

Arno Coetzee

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Try declaring the parameter as a Date in JasperServer and declare parameters as follows:

 

Code:

<parameter name="StartDate" isForPrompting="false" class="java.util.Date">
<defaultValueExpression ><![CDATA[new java.util.Date()]]></defaultValueExpression>
</parameter>

<parameter name="StartDateParameter" isForPrompting="false" class="java.lang.String">
<defaultValueExpression ><![CDATA[new SimpleDateFormat("yyyy-MM-dd"«»).format(new java.util.Date($P{StartDate}.getTime()))]]></defaultValueExpression>
</parameter>

 

And in the query do:

 

Code:
[code]
<queryString language="sql"><![CDATA select StageName, Probability, FirstName, LastName, Amount
from Opportunity join User on (Opportunity.OwnerId = User.Id)
Where IsClosed = FALSE AND CloseDate <= $P{EndDateParameter} AND CloseDate > $P{StartDateParameter}
order by LastName, FirstName]]></queryString>

 

 

There are issues with time zones. Search this forum for "date control" to see solutions.

 

 

Sherman

JasperSoft

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...