Here you can find the source of checkTimestamp(String timestamp)
public static boolean checkTimestamp(String timestamp)
//package com.java2s; //License from project: Open Source License import java.util.Date; import java.util.concurrent.TimeUnit; import java.text.ParseException; import java.text.SimpleDateFormat; public class Main { public static boolean checkTimestamp(String timestamp) { SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); Date time = null;/*from w ww. ja va2 s . co m*/ try { time = dateFormat.parse(timestamp); } catch (ParseException e) { System.out.println("Timestamp check error"); e.printStackTrace(); System.exit(-1); } Date current = new Date(); long diffInMillies = current.getTime() - time.getTime(); TimeUnit timeUnit = TimeUnit.MINUTES; long diff = timeUnit.convert(diffInMillies, TimeUnit.MILLISECONDS); if (diff < 60) return true; return false; } }