相关疑难解决方法(0)

使用Java进行日期比较

我有两个约会:

  1. toDate(用户输入MM/dd/yyyy格式)
  2. currentDate(获得new Date())

我需要比较currentDatetoDate.我只有在toDate等于或大于时才显示报告currentDate.我怎样才能做到这一点?

java date

31
推荐指数
5
解决办法
11万
查看次数

Android 在日期写今天昨天 2 天前这样

我需要像今天、昨天、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)

android jodatime

7
推荐指数
1
解决办法
7156
查看次数

标签 统计

android ×1

date ×1

java ×1

jodatime ×1