String date=“2016-10-01”; DateFormat df=new DateFormat("yyyy-MM-dd"); try{ df.parse(date); }catch(Exception e){ } 有时要扑捉异常,要不然会报错