mardi 11 avril 2017

Caused by: java.lang.IllegalArgumentException: Illegal pattern character 'Y'

Caused by: java.lang.IllegalArgumentException: Illegal pattern character 'Y'


This exceptions can occur, if you want to parse to a date for example and you put the patter of year wrong

on SimpleDateFormat like this:

SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-YYYY");

whereas ,it must be  like this :


SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");

Aucun commentaire:

Enregistrer un commentaire