Whats the difference in using a and aaa in SimpleDateFormat
问题 I want to display current date as 00:50:32 A Here is my code Date date = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss a"); String time = sdf.format(date); System.out.println("time : " + time); But it print as: time : 00:50:32 AM I tried both HH:mm:ss a and HH:mm:ss aaa , but results are the same. 回答1: Can't do! If the pattern is 4 letters or less, short format is used. So 'a', 'aa', 'aaa' and 'aaaa' are identical. All you can do is to format it without 'a', and add 'A' or