Java Question DateTime problem

derez

Expert
Licensed User
Longtime User
using: import anywheresoftware.b4a.keywords.DateTime;

the java code :
B4X:
DateTime.setDateFormat("dd/MM/yyyy") ;
long dGreg = DateTime.DateParse("01/01/2000") ;

errors with this : "Unhandled exception type ParseException"

What should I do ?
 

corwin42

Expert
Licensed User
Longtime User
I think derez question is more WHY the exception is fired since the parameter to DateParse looks like a valid string in the right date format.
 

derez

Expert
Licensed User
Longtime User
Markus is right.
I guess that the datetime variable cannot be checked for all kinds of user mistakes, for example an invalid date like 30/02/2012 , so it tells you to add a precaution for such cases.
 
Top