This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Compare Hours and Minute in java

 
pankaj semwal
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi List,
How can i compare the time in java as my time format is Hours:Minute.
example: i am getting time like this : 1645 and 1500 so how can i compare this time.

Please tell me.

Thanks
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean by compare? Are you looking for which is earlier/later? If so, the Calendar class has before and after methods. Or do you mean find out how much the time difference is? In which case, these two times are just ultimately a long representing a number of milliseconds. You could subtract one from the other.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic