The clarification i need is not JSP Related. But i never able to find the Forum for my clarification.
i need to enter some vaues for Years like this 1.2 or 1(1.2 years or 1 year)
in my JSP, then i need to convert that date into no of days, i am doing that by multiplying 1.2 or 1*365 days, and after that i am using oracle function round to trim decimal values and based on no of days i am performing a search in oracle, to find some results.
but multiplying with 365 days, is not the correct way, because all years are not 365 days, so can anybody give me some knowledge, how to convert it into correct no of days to the year value i am passing.
please reply me , i am in very critical stage.
Biswa Ranjan Mishra
Originally posted by Stan James:
I'm not sure that 1.2 years is precise enough to even worry about leap years. With one decimal place you're only going to get a date within about 3.6525 days. Call the range 4 and your precision plus or minus 2. A day off for leap year is within tolerance.
I think you are assuming that the number has only two significant digits. Maybe the original poster means 1.20000 which would probably be precise enough for the leap day to make a difference. In which case, I agree with Steve's comments above. you should forget about Java and computers. Try and figure out how you would do this by hand. If someone told you that the world ends 1.2500 years from today, how would you figure out how many days that is if you want to account for any possible leap years? What if it is 2.333 years from today? What about 5.0000 years? Using different examples like this should help you to see how to develop an algorithm to do accomplish your task.