We're pleased to have you here with us on the Ranch, but there are a few rules that need to be followed, and one is that proper names are required. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.
In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.
Hi all, pl help me coding to find out number of days between two dates. The two dates are obtained from access database. And, after getting the date from db, can i assign it directly to java.util.Date, or do i have to assign to java.sql.Date. By the way, for the previous post, i dont think Jayasree would be having a last name as not all indian people have first name, last name etc. Thankz very much.
[ January 31, 2005: Message edited by: Wonderboy Rajesh ]
[ January 31, 2005: Message edited by: Wonderboy Rajesh ] [ January 31, 2005: Message edited by: Rajeshkumar Prakasam ]
Since java.sql.Date extends java.util.Date, you can assign it directly to a java.util.Date. Given two Dates (either type), use getTime() to get a long integer representing the number of milliseconds since January 1st, 1970. Subtract one from the other and divide by 1000 * 60 * 60 * 24 for the number of days between them.
All of this information and more is in the JavaDocs. They are extremely useful, and you should get proficient at using them. You'll be able to get answers to some of your questions more quickly than waiting for a reply.