修改格式
This commit is contained in:
parent
6792aea793
commit
9f2f515a4e
@ -236,9 +236,10 @@ public class DateUtil {
|
|||||||
*/
|
*/
|
||||||
public static String getAfterDayDate(String days) {
|
public static String getAfterDayDate(String days) {
|
||||||
int daysInt = Integer.parseInt(days);
|
int daysInt = Integer.parseInt(days);
|
||||||
|
// java.util包
|
||||||
Calendar canlendar = Calendar.getInstance(); // java.util包
|
Calendar canlendar = Calendar.getInstance();
|
||||||
canlendar.add(Calendar.DATE, daysInt); // 日期减 如果不够减会将月变动
|
// 日期减 如果不够减会将月变动
|
||||||
|
canlendar.add(Calendar.DATE, daysInt);
|
||||||
Date date = canlendar.getTime();
|
Date date = canlendar.getTime();
|
||||||
|
|
||||||
SimpleDateFormat sdfd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
SimpleDateFormat sdfd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
@ -255,8 +256,10 @@ public class DateUtil {
|
|||||||
*/
|
*/
|
||||||
public static String getAfterDayWeek(String days) {
|
public static String getAfterDayWeek(String days) {
|
||||||
int daysInt = Integer.parseInt(days);
|
int daysInt = Integer.parseInt(days);
|
||||||
Calendar canlendar = Calendar.getInstance(); // java.util包
|
// java.util包
|
||||||
canlendar.add(Calendar.DATE, daysInt); // 日期减 如果不够减会将月变动
|
Calendar canlendar = Calendar.getInstance();
|
||||||
|
// 日期减 如果不够减会将月变动
|
||||||
|
canlendar.add(Calendar.DATE, daysInt);
|
||||||
Date date = canlendar.getTime();
|
Date date = canlendar.getTime();
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("E");
|
SimpleDateFormat sdf = new SimpleDateFormat("E");
|
||||||
String dateStr = sdf.format(date);
|
String dateStr = sdf.format(date);
|
||||||
@ -335,7 +338,6 @@ public class DateUtil {
|
|||||||
/**
|
/**
|
||||||
* 获取本月开始日期
|
* 获取本月开始日期
|
||||||
*
|
*
|
||||||
* @param pattern
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static Date monthStartDate() {
|
public static Date monthStartDate() {
|
||||||
@ -370,7 +372,14 @@ public class DateUtil {
|
|||||||
*/
|
*/
|
||||||
public static String formatDate(long parseLong, String format) {
|
public static String formatDate(long parseLong, String format) {
|
||||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(format);
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(format);
|
||||||
return simpleDateFormat.format(new Date(parseLong));
|
String date;
|
||||||
|
try {
|
||||||
|
date = simpleDateFormat.format(new Date(parseLong));
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return date;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user