|
2. String conversion time, please note that you can not judge whether the time input is correct, whether the time input is correct, please use regular.
try
{
String st="2015-13-32 12:00";
java.text.DateFormat df = new SimpleDateFormat("yyyy-MM-dd hh:mm");
Date starttime = df.parse(st);
System.out.println(starttime.toString());
}
catch(Exception ex)
{
} |
|