how to convert string date to date format in jasper report

0

Hi Friend I've use Jasper Ireport 5.2.0, i want to generate student mark sheet with student date of birth.

Data type of a date of birth in Table is varchar, so I've convert string date to original date format but result is wrong.

For example date of birth is 08-08-1994(dd-MM-yyyy) but i got after convertion like this 08-04-1996(dd-MM-yyyy). my convertion code is,

new java.text.SimpleDateFormat("dd-MM-yyyy").format(new java.text.SimpleDateFormat("dd-MM-yyyy").parse($F{birthDate})).

where i got mistake, any one can help me asap..... my process is pending.

Thanks to advance

udumanajmeer's picture
Joined: Jun 4 2013 - 9:00pm
Last seen: 3 years 4 months ago

4 Answers:

0

Hey  I hvae tested in my side your code is working fine. You can check with $F{birthDate} field , are you getting correct date form DB or not.

sambitgudu's picture
Joined: Sep 26 2012 - 3:25am
Last seen: 2 years 10 months ago
0
(new SimpleDateFormat("dd/MM/yy").format($F{birthDate})) try this.......... i think it will work for you...
chaitanya chauhan's picture
Joined: Jul 30 2013 - 11:57pm
Last seen: 5 years 2 months ago
0

I have a Similar Problem. For a jasper report, I am passing the Report Date as Parameter String in dd/MM/yyyy format. But I would like to convert this string to MMM dd, yyyy format during the runtime. The (new SimpleDateformat ("MMM dd, yyyy).format($P{REPORT_DATE}) is not working, I get runtime error. Please help

 

 

vickey24's picture
Joined: May 2 2014 - 4:11am
Last seen: 2 years 11 months ago
1

(new SimpleDateFormat("MMM dd, YYYY").format($P{REPORT_DATE}))

 

This will work. SimpleDateFormat is case sensitive.

virenptl40's picture
Joined: Jul 3 2014 - 6:43am
Last seen: 3 years 2 months ago
Feedback
randomness