This is a date, not a timestamp. You can java.text.SimpleDateFormat it using java.text.SimpleDateFormat using the format yyyy-dd-MM-HH.mm.ss :
SimpleDateFormat sdf = new SimpleDateFormat("yyy-dd-MM-HH.mm.ss"); Date date = sdf.parse(inputDateString); long timestamp = date.getTime();
And then compare - a minute of 60 * 1000 milliseconds.
Using joda-time for date and time operations is always preferable - it will be:
- have a thread-safe implementation of dataformat -
DateTimeFormat (the above is not thread-safe) - just do
Minutes.minutesBetween(..) to find out the minutes between two moments, not to calculate.
Bozho source share