|
|
|
@ -15,6 +15,7 @@ public final class DateTimeUtil { |
|
|
|
public static Date ParseDate(String dateStr) throws ParseException { |
|
|
|
return dateFormat.parse(dateStr); |
|
|
|
} |
|
|
|
|
|
|
|
public static Date ParseDateDetail(String dateStr) throws ParseException { |
|
|
|
return dateFormatDetail.parse(dateStr); |
|
|
|
} |
|
|
|
@ -58,6 +59,7 @@ public final class DateTimeUtil { |
|
|
|
} |
|
|
|
return dateFormat.format(date); |
|
|
|
} |
|
|
|
|
|
|
|
public static String FormatDateDetail(Date date) { |
|
|
|
if (date == null) { |
|
|
|
return ""; |
|
|
|
@ -70,45 +72,41 @@ public final class DateTimeUtil { |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static String getYMD() |
|
|
|
{ |
|
|
|
SimpleDateFormat formatter = new SimpleDateFormat ("yyyy年MM月dd日"); |
|
|
|
Date curDate = new Date(System.currentTimeMillis());//获取当前时间 |
|
|
|
String str = formatter.format(curDate); |
|
|
|
public static String getYMD() { |
|
|
|
SimpleDateFormat formatter = new SimpleDateFormat("yyyy年MM月dd日"); |
|
|
|
Date curDate = new Date(System.currentTimeMillis());//获取当前时间 |
|
|
|
String str = formatter.format(curDate); |
|
|
|
return str; |
|
|
|
} |
|
|
|
public static String getYMD(Date string) |
|
|
|
{ |
|
|
|
SimpleDateFormat formatter = new SimpleDateFormat ("yyyy-MM-dd"); |
|
|
|
String str = formatter.format(string); |
|
|
|
|
|
|
|
public static String getYMD(Date string) { |
|
|
|
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
|
String str = formatter.format(string); |
|
|
|
return str; |
|
|
|
} |
|
|
|
|
|
|
|
public static String getYMD2(Date string) |
|
|
|
{ |
|
|
|
SimpleDateFormat formatter = new SimpleDateFormat ("yyyy/MM/dd"); |
|
|
|
String str = formatter.format(string); |
|
|
|
public static String getYMD2(Date string) { |
|
|
|
SimpleDateFormat formatter = new SimpleDateFormat("yyyy/MM/dd"); |
|
|
|
String str = formatter.format(string); |
|
|
|
return str; |
|
|
|
} |
|
|
|
public static String getYMD3(Date string) |
|
|
|
{ |
|
|
|
SimpleDateFormat formatter = new SimpleDateFormat ("MM月dd日"); |
|
|
|
String str = formatter.format(string); |
|
|
|
|
|
|
|
public static String getYMD3(Date string) { |
|
|
|
SimpleDateFormat formatter = new SimpleDateFormat("MM月dd日"); |
|
|
|
String str = formatter.format(string); |
|
|
|
return str; |
|
|
|
} |
|
|
|
|
|
|
|
public static String getYMDHMS() |
|
|
|
{ |
|
|
|
SimpleDateFormat formatter = new SimpleDateFormat ("yyyy年MM月dd日 HH:mm:ss"); |
|
|
|
Date curDate = new Date(System.currentTimeMillis());//获取当前时间 |
|
|
|
String str = formatter.format(curDate); |
|
|
|
public static String getYMDHMS() { |
|
|
|
SimpleDateFormat formatter = new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss"); |
|
|
|
Date curDate = new Date(System.currentTimeMillis());//获取当前时间 |
|
|
|
String str = formatter.format(curDate); |
|
|
|
return str; |
|
|
|
} |
|
|
|
|
|
|
|
public static String getStrYMD(String str) |
|
|
|
{ |
|
|
|
public static String getStrYMD(String str) { |
|
|
|
SimpleDateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); |
|
|
|
Date date= null; |
|
|
|
Date date = null; |
|
|
|
try { |
|
|
|
date = df.parse(str.trim()); |
|
|
|
} catch (ParseException e) { |
|
|
|
@ -120,8 +118,7 @@ public final class DateTimeUtil { |
|
|
|
return stra; |
|
|
|
} |
|
|
|
|
|
|
|
public static long getDays(Date d1,Date d2) |
|
|
|
{ |
|
|
|
public static long getDays(Date d1, Date d2) { |
|
|
|
long diff = d1.getTime() - d2.getTime();//这样得到的差值是微秒级别 |
|
|
|
long days = diff / (1000 * 60 * 60 * 24); |
|
|
|
return days; |
|
|
|
|