Live Scores
Sport Statistics
Movie Stars
Programming
Multimedia
Mobile
Database
Enterprise
in
Eclipse
Java Editors & IDEs
(Entire Site)
Date and Time compare in Java
I need to compare 2 timestamps which the received timestamp is within 10min of the current timestamp. Note that the revTimeStamp will come in a form of String.
String revTimeStamp = new Date().toString();
String currentTimeStamp = new Date().toString();
//compare how???
Solution: Date and Time compare in Java
its a little unclear what you want to achieve here.
I am going to assume the following (if i am wrong you will have to extrapolate):
current date is now
received date is some past date.
if((currentDate.getTime() - receivedDate.getTime()) <= 10 * 60 * 1000)
{
//the current date is equal to or less than 10 mins after received date
}else{
// current date is more that 10 mins after recieved date.
}
Popular Tags
Tags:
3.3
3.3.1.1
ant
Apache
C++
class
connection
CVS
debug
Eclipse
Eclipse Java
editor
file
firefox
from
IBM
J2EE
jar
Java
jsp
myeclipse
mysql
php
plugin
project
rad
Sun
tomcat
weblogic
Browse All Tags