I'm trying to work with dates and experiencing a problem: java.util.Date library accepts bad dates from file for example: 2014/99/99 . Later it somehow converts it and from 2014/99/99 I get 2022/04/09. Is there an easy way to cope with this problem?
Here's the code:
Date ikalintasNuo = null;
static DateFormat df = new SimpleDateFormat("yyyy/MM/dd");
private static Scanner scan;
ikalintasNuo = df.parse(scan.next());
Input from file : 2014/99/99 Output: 2022/04/09