| Forums.Sureshkumar.net : A Perfect Place to Share Knowledge Blogs Games Magazines |
|
|||||||
| EJB EJB Interview Questions asked in various Interviews. Professionals are invited to share Answers for these EJB Interview Questions. EJB Interview Questions with answers, Experiences, Career Advices, Tips and more. |
![]() |
|
|
LinkBack | Thread Tools | Rate Thread | Display Modes |
|
|
#2 (permalink) |
|
Junior Member
Join Date: Aug 2008
Posts: 1
Thanks: 0 Thanked 0 Times in 0 Posts Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 1
|
logic for date difference in years
this is the new method , instead of Date pass Calendar object which need to be calculate
- public static int calcAge(Calendar dob) { int age = 0; Calendar curDate = Calendar.getInstance(); Calendar tmpDate = Calendar.getInstance(); tmpDate.setTime(dob.getTime()); tmpDate.set(Calendar.YEAR,curDate.get(Calendar.YEAR)); if (dob.before(curDate)) { age = curDate.get(Calendar.YEAR) - dob.get(Calendar.YEAR); if (tmpDate.after(curDate)) { age--; } } return age; } |
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How do enterprise beans access native libraries | Shailu07 | EJB | 0 | 09-05-08 08:44 PM |
| How enterprise beans will handle concurrent and loopback calls on entity beans | Shailu07 | EJB | 0 | 09-05-08 04:22 PM |
| How entity beans support container managed persistence | Shailu07 | EJB | 0 | 09-05-08 04:09 PM |
| One farmer cultivates beans, corns, kale, squash and wheat in a year | m.gayatri | Aptitude Questions | 0 | 24-01-07 02:19 PM |
| j2ee interview Q & A | jasmine84 | JAVA Technologies | 4 | 23-01-07 02:09 AM |