我有两个约会:
toDate(用户输入MM/dd/yyyy格式)currentDate(获得new Date())我需要比较currentDate用toDate.我只有在toDate等于或大于时才显示报告currentDate.我怎样才能做到这一点?
我需要像今天、昨天、2 天前那样打印日期,因为我已经完成了我得到的日期就像:String date1 = "Thu Nov 13 19:01:25 GMT+05:30 2014";
打电话str=get_userTime(date1);
private String get_userTime(String usertime) {
Date d = null;
// String datee = "Thu Nov 13 19:01:25 GMT+05:30 2014";
String datee = usertime;
SimpleDateFormat inputFormat = new SimpleDateFormat(
"EE MMM dd HH:mm:ss zz yyy");
try {
d = inputFormat.parse(datee);
} catch (java.text.ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
SimpleDateFormat outputFormat1 = new SimpleDateFormat("MM/dd/yyyy");
System.out.println(outputFormat1.format(d));
op = outputFormat1.format(d);
op=formatToYesterdayOrToday(op);
return op;
}
Run Code Online (Sandbox Code Playgroud)
这是昨天/今天获得的另一个功能,我使用了这个链接
public …Run Code Online (Sandbox Code Playgroud)