Here you can find the source of isTimeAfter(String webTime, String localTime)
@SuppressLint("SimpleDateFormat") public static int isTimeAfter(String webTime, String localTime)
//package com.java2s; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import android.annotation.SuppressLint; public class Main { @SuppressLint("SimpleDateFormat") public static int isTimeAfter(String webTime, String localTime) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); // Log.i("WEB", "isTimeAfter: time1 " + theTime + " time2 " + theTime2); Date serverTime = null;/*www .j a v a2s.c om*/ Date deviceTime = null; try { serverTime = sdf.parse(webTime); deviceTime = sdf.parse(localTime); } catch (ParseException e) { e.printStackTrace(); } // n < 0 before // n > 0 after // n == 0 equal return serverTime.compareTo(deviceTime); } }