This is probably a very simple question but I dont see the problem or how to resolve it. Thank you for you help.
String date = "04/11/1972"
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/YYYY");
System.out.println(sdf.format(sdf.parse(date));
and it displays : 03/01/1972
Why? How to get back my date. it seems there is a problem with the parse which does not give the proper Date object
Thank you
It is yyyy
not YYYY
for the year field.
That may be the problem! So try this:
String date = "04/11/1972";
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
System.out.println(sdf.format(sdf.parse(date)));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With