In your second example: SimpleDateFormat format = new SimpleDateFormat("HH:MM:ss", locale);
, you are using MM
instead of mm
, so it is the month number instead of the minutes that gets printed (is should be 05 for May though).
different time results with Locale
문제
SimpleDateFormat formato =new SimpleDateFormat("HH:mm:ss");
Calendar cal = Calendar.getInstance();
String fecha11 = String.valueOf(formato.format(cal.getTime()));
Locale locale = new Locale("es", "ES");
SimpleDateFormat format = new SimpleDateFormat("HH:MM:ss", locale);
String fecha22 = String.valueOf(format.format(cal.getTime()));
Results: 14:06:12 (same that hour in my device) 14:16:55 (with Locale("es", "ES"))
And yes, i am in Spain (Bcn) ¬¬' somebody would explain me why?? And next question, is it happen when i change Locale to others countries?
Thanks,
Àlex
해결책
다른 팁
mm is minutes. MM is month
your second format is Hour:Month:Seconds
edited after assylias comment
제휴하지 않습니다 StackOverflow