I'm receiving a date as a String like this :2015-07-22.06.05.56.344
. I wrote a parsing code like this
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd.hh.MM.ss.ms");
try {
Date date = sdf.parse("2015-07-22.06.05.56.344");
System.out.println(date);
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
And I got the output like this:
Fri May 22 06:03:44 IST 2015
Why is it reading it wrongly? Is it an issue with my code or java cannot recognize this date format?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…