原文鏈接:https://blog.csdn.net/bronzehammer/article/details/101013441 (侵刪)
1.String轉換成Date類型
SimpleDateFormat ft = new SimpleDateFormat("yyyy-MM-dd"); String time = "2019-09-19"; Date date = ft.parse(time)
2.Date轉換成String類型
SimpleDateFormat ft = new SimpleDateFormat("yyyy-MM-dd"); Date date = new Date(); String time = ft.format(date);