I got wrong result when using SimpleDateFormat.parse()
.
Code here:
public static void main(String[] args) throws ParseException {
String format = "yyyyMMdd";
String date = "19890416";
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(format);
java.util.Date date2 = simpleDateFormat.parse(date);
System.out.println("date2 = " + date2);
System.out.println("Locale.getDefault() = " + Locale.getDefault());
}
result:
date2 = Sun Apr 16 01:00:00 CDT 1989
Locale.getDefault() = zh_CN
there is my question:
why in the result it shows up 01:00:00
, instead of 00:00:00
?
What should I do if I want 00:00:00
?
Anyone can help? Thanks!
Update: I want to know, when define format as "yyyyMMdd", why the default hour shows up "01", thanks.