• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to find difference between dates  RSS feed

 
Anupama Avadutha
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
This is my first post in Java Ranch.Please excuse me if my question seems to be too simple. I want to know how to find the difference between two dates in java.Somehow i did not understand java dates concept properly.Thank you in advance.
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
anupama, please check your private messages. You can see them by clicking My Private Messages.

There's nothing very difficult about dates in Java. If you have two Date objects, you can call getTime() on both the objects and subtract the values from each other - that will give you the difference between the dates in milliseconds.
 
Anupama Avadutha
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you i will try this and approach you back if i have any doubt.
 
Ramaswamy Srinivasan
Ranch Hand
Posts: 295
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Anupama,

Readymade recepies are available. Though it would not be advisable to take them when you begin programming, once in a while you can do it!

This article gives you all you are looking for!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!