Jeanne Boyarsky wrote:Shubhank,
Welcome to CodeRanch!
You can get the database date in a query via JDBC. The exact query varies by database. Then you have both dates in Java memory and can compare. Note that it is likely that the application and database server are slightly different under the best of circumstances.
thanks Jeanne, but i have current date java.util type and get database date in other format than can i compare both day by day.
Normally, you'd get a java.sql.Date from the database (which is a subclass of java.util.Date). The java.util.Date class has methods to check if another date is before or after the Date object you're calling it on.
For example, a lot of applications really need to know that one date is earlier than another, at millisecond precision or better, but don't actually care about the accuracy of the time, it could be even an hour off of "official" time, and the application would work just fine.
Others want the time to be correct, in sync with say the astronomical time, so you can point your telescope at the right part of the sky, but don't care about precision under a second.
Java's built in date/time code is actually fairly weak at providing either at high scaling rates.