【发布时间】:2014-10-10 13:30:50
【问题描述】:
我有两个日期时间 09/01/2014 和 09/10/2014。我想检查两个日期时间之间的天数。 我写了一个函数来改变日期时间格式
public static String dateFormatterforLukka(String inputDate) {
String inputFormat = "MM/dd/yyyy";
String outputFormat = "d MMM";
Date parsed = null;
String outputDate = "";
try {
SimpleDateFormat df_input = new SimpleDateFormat(inputFormat,
new Locale("en", "US"));
SimpleDateFormat df_output = new SimpleDateFormat(outputFormat,
new Locale("en", "US"));
parsed = df_input.parse(inputDate);
outputDate = df_output.format(parsed);
} catch (Exception e) {
outputDate = inputDate;
}
return outputDate;
}
但我不知道如何解决我的问题 如果有人知道解决方案,请帮助我
【问题讨论】:
-
结果是什么?有错误吗?
-
你尝试了什么?你只是在解析两个日期......
-
Date Difference in java 的可能重复项
-
我没有错误,但这是唯一的日期时间格式更改功能。但我不知道如何检查两个日期时间之间的天数
标签: android datetime numbers days