wood burning stoves 2.0*
The moose likes Java in General and the fly likes timestamps Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "timestamps" Watch "timestamps" New topic
Author

timestamps

manasa teja
Ranch Hand

Joined: May 27, 2002
Posts: 325
Hiw to find difference between two time stamps?
Is there any direct method , which gives the difference.. what is the easy way to do it.
thanks
ram


MT
Nayanjyoti Talukdar
Ranch Hand

Joined: Feb 12, 2002
Posts: 71
Hi,
I don't think there is any direct method to get the difference between timestamp. You'll have to formulate using GregorianCalendar.
-----------
Nayan.
Nayanjyoti Talukdar
Ranch Hand

Joined: Feb 12, 2002
Posts: 71
One more solution....
U can use the class called Timestamp which extends Date class. Date class has methods of comparing two objects.
Hope, this helps u.
------------
Nayan
K Elangovan
Greenhorn

Joined: Jan 17, 2003
Posts: 6
Hi Nayanjyoti Talukdar,
Can you give a small example code?
Thanks in advance.
K. Elangovan.
Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
The difference as what? The simplest way is to use getTime() to get the timestamps in milliseconds since 1970, which is a long. You can simply subtract the two values to get the difference in milliseconds.
That may or may not be useful to you.
- Peter
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: timestamps
 
Similar Threads
Array Initilaize
Clarification
interview question
WA #1.....word association
Why anonymous posts are allowed in this forum ?