java - Cannot format given Object as a Date - Stack Overflow As others have said, SimpleDateFormat format cannot accept a String argument, also when the parameter type is declared to be Object Because of the exception you didn’t get around to discovering: there is also a bug in your format pattern string, mm yyyy