datetime - Java Timestamp Comparison -


I have a timestamp passed from external source in the format 2011-01-23-12.31.45. I need to compare it to its current system timestamp, make sure that any ideas about how to complete this less than 2 minutes difference?

This is a date, not a timestamp java.text.SimpleDateFormat Using it to be parsed using the yyyy-dd-MM-HH.mm.ss format :

  Simetred formatting SDF = New SimpleDatabase (" Yyy-dd-MM-HH.mm.ss "); Date date = sdf.parse (inputDateString); Long timestamp = date.getTime ();   

And then compare - 60 * 1000 million in a minute.

Experiment is always preferred for date-time operations - this would be:

  • is a thread-safe implementation of the dataformat - datetime format
  • / Li>

Comments