Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Date comparison help

 
Gemini Moses
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can someone please help me do this simple data comparison in java.


String dbDate = dateRetrivedFromOracleDB

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


Thanks!
 
Campbell Ritchie
Sheriff
Pie
Posts: 50225
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic