i have to allow the user into Database table ,who is having minimum 1year service in a company..
for that i have to find today date and user's date of join from database..
and then subtract..right? but..i confuse..how to do it?..how to find the difference between two days?
Thanks & Regards, seetharaman.v
Jhakda Velu
Ranch Hand
Joined: Feb 26, 2008
Posts: 158
posted
0
Hi Why don't you handle this in your query itself? Sysdate will give you current date and time, and the date of joining that would have been stored in the table can be subtracted. If its stored as Varchar(instead of date) use the inbuilt to_date function. This, alongwith a bit of googling will get you through.
Jhakda
If I become filthy rich, I'll sponsor research for painless dental treatment at Harvard Medical School. Thats why,I'm learning Java.I have 32 teeth, 22 are man made.
There is one problem with that code: it is defective because of daylight savings time. Because of that, days can have 23 or 25 hours as well.
Using Calendar.get(Calendar.DAY_OF_YEAR) and Calendar.get(Calendar.YEAR), combined with Calendar.getActualMaximum(Calendar.DAY_OF_YEAR), you can calculate the result more precisely. Search on this forum, I've answered this question at least 3 times already.