if I execute this code:
String data = "08/02/1941";
SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
Date date = dateFormat.parse(data);
I have in output the date: Sat Feb 08 01:00:00 CEST 1941
instead if I execute this code:
String data = "08/02/1971";
SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
Date date = dateFormat.parse(data);
the date is: Sat Feb 08 01:00:00 CET 1971.
Why do I have this difference (CET and CEST)?
My timezone is Europe/Berlin (UTC+1) and I'm using Java 1.7.0_67-b01
1941being reported in both outputs.java.util.Date,java.util.Calendar, andjava.text.SimpleDateFormatare now legacy, supplanted by the java.time classes built into Java 8 and later. See Tutorial by Oracle.