Commit 4b0fe3ba by zhangxingmin

push

parent 904dd7fd
......@@ -125,8 +125,24 @@ public class DateUtil {
}
}
public static String yyMMdd(String timeStr){
try {
// 定义输入格式
SimpleDateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
Date date = inputFormat.parse(timeStr);
// 定义输出格式
SimpleDateFormat outputFormat = new SimpleDateFormat("yyMMdd");
String result = outputFormat.format(date);
return result;
} catch (Exception e) {
return "";
}
}
public static void main(String[] args) {
System.out.println(getHHmm(LocalDateTime.now()));
System.out.println(yyMMdd("2025-02-20 11:30"));
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment