【发布时间】:2020-01-16 16:19:03
【问题描述】:
我在表单中收到一个编译错误:
incompatible types:java.util.date cannot to be converted to java.sql.Date
Date date=null;
date=new SimpleDateFormat("d MM y").parse((String)getSutunlar().get(index).getProduct_date());
【问题讨论】:
-
我建议你不要使用
SimpleDateFormat和Date。这些类设计不良且过时,尤其是前者,尤其是出了名的麻烦。而是使用来自java.time, the modern Java date and time API 的LocalDate和DateTimeFormatter。