【fix sonar】DateUtils文件
This commit is contained in:
+10
-11
@@ -137,12 +137,12 @@ public class DateUtils extends PropertyEditorSupport {
|
|||||||
/**
|
/**
|
||||||
* 日期转换为字符串
|
* 日期转换为字符串
|
||||||
*
|
*
|
||||||
* @param date_sdf 日期格式
|
* @param dateSdf 日期格式
|
||||||
* @return 字符串
|
* @return 字符串
|
||||||
*/
|
*/
|
||||||
public static String date2Str(SimpleDateFormat date_sdf) {
|
public static String date2Str(SimpleDateFormat dateSdf) {
|
||||||
Date date = getDate();
|
Date date = getDate();
|
||||||
return date_sdf.format(date);
|
return dateSdf.format(date);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -154,27 +154,27 @@ public class DateUtils extends PropertyEditorSupport {
|
|||||||
*/
|
*/
|
||||||
public static String dateformat(String date, String format) {
|
public static String dateformat(String date, String format) {
|
||||||
SimpleDateFormat sformat = new SimpleDateFormat(format);
|
SimpleDateFormat sformat = new SimpleDateFormat(format);
|
||||||
Date _date = null;
|
Date dateNew = null;
|
||||||
try {
|
try {
|
||||||
_date = sformat.parse(date);
|
dateNew = sformat.parse(date);
|
||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
return sformat.format(_date);
|
return sformat.format(dateNew);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 日期转换为字符串
|
* 日期转换为字符串
|
||||||
*
|
*
|
||||||
* @param date 日期
|
* @param date 日期
|
||||||
* @param date_sdf 日期格式
|
* @param dateSdf 日期格式
|
||||||
* @return 字符串
|
* @return 字符串
|
||||||
*/
|
*/
|
||||||
public static String date2Str(Date date, SimpleDateFormat date_sdf) {
|
public static String date2Str(Date date, SimpleDateFormat dateSdf) {
|
||||||
if (null == date) {
|
if (null == date) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return date_sdf.format(date);
|
return dateSdf.format(date);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -251,8 +251,7 @@ public class DateUtils extends PropertyEditorSupport {
|
|||||||
Date dt = new Date();
|
Date dt = new Date();
|
||||||
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
String nowTime = df.format(dt);
|
String nowTime = df.format(dt);
|
||||||
java.sql.Timestamp buydate = java.sql.Timestamp.valueOf(nowTime);
|
return java.sql.Timestamp.valueOf(nowTime);
|
||||||
return buydate;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ////////////////////////////////////////////////////////////////////////////
|
// ////////////////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
Reference in New Issue
Block a user