Here you can find the source of isExpire(String strTime, String strExpiredTime)
public static boolean isExpire(String strTime, String strExpiredTime)
//package com.java2s; //License from project: Open Source License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.TimeZone; public class Main { static public final String FORMAT_NORMAL = "yyyy-MM-dd HH:mm:ss"; public static boolean isExpire(String strTime, String strExpiredTime) { Date time = parse(strTime, FORMAT_NORMAL); Date expiredTime = parse(strExpiredTime, FORMAT_NORMAL); return (time.compareTo(expiredTime) >= 0); }/*from w w w. j a v a 2s . co m*/ public static Date parse(String str, String format) { try { SimpleDateFormat sf = new SimpleDateFormat(format); sf.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai")); return sf.parse(str); } catch (ParseException e) { e.printStackTrace(); return null; } } }