未符合项/重点问题管理
This commit is contained in:
@@ -55,6 +55,36 @@ public class DateUtil {
|
||||
return dateTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将日期对象转换为指定的日期字符串
|
||||
*
|
||||
* @param date 传入的日期对象
|
||||
* @param format 格式
|
||||
* @return 日期字符串
|
||||
* @author 赵肖云
|
||||
*/
|
||||
public static String dateToString(Date date, String format) {
|
||||
String string = "";
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(format);
|
||||
if (date != null) {
|
||||
string = simpleDateFormat.format(date);
|
||||
}
|
||||
return string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将日期字符串转换为一个日期对象
|
||||
*
|
||||
* @param datestr 日期字符串
|
||||
* @param format 格式
|
||||
* @return Date
|
||||
* @author 赵肖云
|
||||
*/
|
||||
public static Date stingToDate(String datestr, String format) throws ParseException {
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(format);
|
||||
return simpleDateFormat.parse(datestr);
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
String utcTime = "2021-04-15T01:43:54.296Z";
|
||||
|
||||
Reference in New Issue
Block a user