日期处理
//y 代表年
//M 代表月
//d 代表日
//H 代表24进制的小时
//h 代表12进制的小时
//m 代表分钟
//s 代表秒
//S 代表毫秒
import java.text.SimpleDateFormat;
import java.util.Date;
public class Main {
public static void main(String[] args) {
//format将日期格式化为字符串
Date date = new Date();
String str1 = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").format(date);
System.out.println(str1);
//字符串转日期
SimpleDateFormat s = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
String str2 = "2020/4/14 12:37:11";
Date d = s.parse(str2);
System.out.println(d);
}
}