How to change m/d/yy date parameter format to dd-mon-yyyy jasperstudio?

0

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

trvpseudo's picture
Joined: Jan 30 2019 - 11:02pm
Last seen: 15 hours 54 min ago

2 Answers:

0

DONE!

in query do :
to_date($P{SELECTED_DATE}, 'dd-mon-yy') ------#or any date format

a day of wasting time duh, lol.

hv a nice day all

trvpseudo's picture
Joined: Jan 30 2019 - 11:02pm
Last seen: 15 hours 54 min ago
0

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

C-Box's picture
1945
Joined: Jul 19 2006 - 5:58pm
Last seen: 5 days 6 hours ago
Feedback
randomness