2个回答
展开全部
public static int getIntervalDays(String date1, String date2) {
return getIntervalDays(getTime(date1), getTime(date2));
}
public static int getIntervalDays(long s1, long s2) {
return (int) ( (s1 - s2) / (24 * 3600 * 1000L));
}
public static java.sql.Date str2date(String sDate) {
if (sDate == null || sDate.equals(""))
return null;
if (sDate.charAt(0) > '9' || sDate.charAt(0) < '0')
return null;
sDate = sDate.replace('/', '-');
String[] ar = strSplit(sDate, "- :");
if (ar.length < 3)
return null;
return java.sql.Date.valueOf(ar[0] + "-" + ar[1] + "-" + ar[2]);
}
public static long getTime(Object date) {
if (isEmpty(date))
return System.currentTimeMillis();
return str2date(date.toString()).getTime();
}
public static String getDateFromDate(String date, int avail) {
long lg = getTime(date);
return getDateString(lg + (long) avail * 86400000L);
}
public static String getDateString(long mill) {
java.sql.Date date = new java.sql.Date(mill);
return date.toString();
}
return getIntervalDays(getTime(date1), getTime(date2));
}
public static int getIntervalDays(long s1, long s2) {
return (int) ( (s1 - s2) / (24 * 3600 * 1000L));
}
public static java.sql.Date str2date(String sDate) {
if (sDate == null || sDate.equals(""))
return null;
if (sDate.charAt(0) > '9' || sDate.charAt(0) < '0')
return null;
sDate = sDate.replace('/', '-');
String[] ar = strSplit(sDate, "- :");
if (ar.length < 3)
return null;
return java.sql.Date.valueOf(ar[0] + "-" + ar[1] + "-" + ar[2]);
}
public static long getTime(Object date) {
if (isEmpty(date))
return System.currentTimeMillis();
return str2date(date.toString()).getTime();
}
public static String getDateFromDate(String date, int avail) {
long lg = getTime(date);
return getDateString(lg + (long) avail * 86400000L);
}
public static String getDateString(long mill) {
java.sql.Date date = new java.sql.Date(mill);
return date.toString();
}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询