er.navneetverma Posted April 29, 2019 Share Posted April 29, 2019 Hello Everyone, I am ussing a date Input control and passing it to a database procedure. It is throwing ORA error ORA-01858: a non-numeric character was found where a numeric was expected, on investigation I found that the date I which I selected using calender in form of DD/MM/YYYY is passing as M/D/YY HH:MI:aaaa (4/1/19 12:00 AM ), I have tried changing jasperserver_config file under jaspersoft-server-windowswebappsjasperserver-proWEB-INFbundles, It changes the format of calender selected date but it is still passing date in M/D/YY HH:MI:aaaa format in database. Please help. Thanks Link to comment Share on other sites More sharing options...
salemfahad Posted April 29, 2019 Share Posted April 29, 2019 I don't understand which date you are trying to change but if you are looking for making a change in your report, you do so by changing the date format by clicking on the Text Field where you put the date.If you want to change input date format, you should try using to_char and force it to a specific format which worked for me. Link to comment Share on other sites More sharing options...
er.navneetverma Posted April 29, 2019 Author Share Posted April 29, 2019 In the Jasperserver, I am selecting date in format DD/MM/YYYY using Input control of type DATE, but when I tried printing that date on my report, it comes in M/D/YY HH:MI:aaaa format and giving error when passed to database.I want o change the format of date passed to database. I want it in DD/MM/YYYY format only. Thanks Link to comment Share on other sites More sharing options...
er.navneetverma Posted April 29, 2019 Author Share Posted April 29, 2019 In the Jasperserver, I am selecting date in format DD/MM/YYYY using Input control of type DATE, but when I tried printing that date on my report, it comes in M/D/YY HH:MI:aaaa format and giving error when passed to database.I want o change the format of date passed to database. I want it in DD/MM/YYYY format only.Thanks Link to comment Share on other sites More sharing options...
joseng62 Posted April 29, 2019 Share Posted April 29, 2019 When you are refering to passed to database, i assume you mean the SQL query ? You situations is a standalone report designed in jasperstudio and deployed to jasper server or you making use of jasper pro ad hoc reports ? Different approach for both.If you own designed report, which library for the dates are you utilizing. Are you making use of jasper relative date ranges ? Example class : net.sf.jasperreports.types.date.DateRange At the end you date parameter that links to Jasper server input control need to be the same. If the SQL date format is different then you need to handle this and parse it. So after your date parameter, you need to have another parameter and maybe make use of DATEFORMAT method to change the date format to the format you want. Example DATEFORMAT(mydateobject, mydateformat)Now you date will always be the same format. So on your sql query you can make use of TO_DATE to parse the date so you database can understand. Example TO_DATE($P{myformateddate},'M/D/YY HH:MI:aaaa') Hope this helps. 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