read a date from a text file and put an object date

advertisements

I have to read a Date from a file and the date is written on this file in this way: dd/MM//yy but when the I read I obtain values totally different. For example: 17/11/10 became Mon Jan 04 00:00:00 CET 2010. The value is different.why?

This is the code I use:

SimpleDateFormat sdf=new SimpleDateFormat("dd/MM/YY");
Date dat=sdf.parse(reader.readLine());


The placeholder for year is yy, not YY. Don't know why it gives this result, though.