Hi All,
so i create a parameter $P{SELECTED_DATE} and will be prompted when user want to generate report based on the date they select.
problem is when jasperstudio try to query, its like "...where col_date = '2/8/19'...." (8 february 2019, and it is date type), while my col_date return '08-FEB-2019' (date type), so it wont match.
i try to change the pattern in jasperstudio, a label which the param will be written within the page, but only applied there in label and not the query before it generate the report.
try new SimpleDateFormat...... in parameter expression, but can only as default expression where '2/8/19' will soon replace it again after user select the date then the query wont match.
is there a way to change the user input result '2/8/19' to '8-FEB-2019' in jasperstudio? i tried to reduce too many logic/convertion in my sql.
short version : how can i get pattern 'dd-mon-yyyy' from my date_input, not 'm/d/yy' in jasperstudio?
im using oracle sql.
thanks in advance!
TV
2 Answers:
isn't your date column in your database of type DATE or DATETIME? Don't understand why you query with formatted string (so I interpreted your initial question)?!? Or is the column in database of type CHAR/VARCHAR?
So we also query data params (report parameter type = java.util.date) by the user and it's either if the user has german pattern or english one, so the input is always in locale pattern and automatically transfered as java.util.date to the jasperreports query engine no matter if the user entered in "dd.mm.yyyy" or "yyy-mm-dd" pattern?!?!
regards
C-Box