_garfield_ Posted February 13, 2008 Share Posted February 13, 2008 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 More sharing options...
swood Posted February 14, 2008 Share Posted February 14, 2008 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. ShermanJasperSoft Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now