This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Date comparison help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Date comparison help" Watch "Date comparison help" New topic

Date comparison help

Gemini Moses
Ranch Hand

Joined: Jan 04, 2001
Posts: 245
Can someone please help me do this simple data comparison in java.

String dbDate = dateRetrivedFromOracleDB

if( dbDate + 15 minutes > sysdate)
condition 1
condition 2

Campbell Ritchie

Joined: Oct 13, 2005
Posts: 37890
What class are you using to represent the Date? Is it this? You will have to go through its documentation and work out which methods add 15 minutes, and which methods return the milliseconds since 1st Jan 1970 as a long. Then you can compare the value with sysdate, which you can obtain from methods of the System class.

The rest is easy.
I agree. Here's the link:
subject: Date comparison help
Similar Threads
if Statement
= Operator
problem in relative path in jsp page
sequence generator with mysql
change bgcolor of row dynamically ???