This week's book giveaway is in the JDBC forum.
We're giving away four copies of Make it so: Java DB Connections & Transactions and have Marcho Behler on-line!
See this thread for details.
The moose likes Java in General and the fly likes Comparision of Time Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Comparision of Time" Watch "Comparision of Time" New topic

Comparision of Time

jaya repaka

Joined: Nov 06, 2003
Posts: 18
Hi All,
I have one date field.I am getting the time(hh:mm a) as
example: 10.30 PM I wanted to compare this time with hard coded value(8.30PM)
Is there way to compare two time(if(this time> hardcoded time)- 10.30PM > 8.30PM)..If there is a way please le me know..

Thanks in advance

Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923

I read this:

and throw a QuestionNotUnderstoodException.
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42959
If you have the dates as java.util.Date or java.util.Calendar objects, you can use the before() and after() methods.
I agree. Here's the link:
subject: Comparision of Time
It's not a secret anymore!