SimpleDateFormat formatter = new SimpleDateFormat ("yyyy-MM-dd");
//假定像2002-07-04的是合法日期其他都非法。
String str="2002.07.04";
ParsePosition pos = new ParsePosition(0);
Date dt=formatter.parse(str,pos);
if(dt!=null)
{
//是合法日期
}
else
{
//非法日期
}
//假定像2002-07-04的是合法日期其他都非法。
String str="2002.07.04";
ParsePosition pos = new ParsePosition(0);
Date dt=formatter.parse(str,pos);
if(dt!=null)
{
//是合法日期
}
else
{
//非法日期
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货