When I use the \"HH\" flag in android.text.format.DateFormat
, it is interpreted as a literal \"HH\". But when I use java.text.SimpleDateFormat
it
For android.text.format.DateFormat you designate Hour in day as kk
like this:
String dateAndroid = android.text.format.DateFormat.format(
"dd-MM-yyyy kk:mm:ss", calendar).toString();
For java.text.SimpleDateFormat you designate hour in day as HH
.
H hour in day (0-23)
Documentation for android.text.format.DateFormat:
public static final char HOUR_OF_DAY
This designator indicates the hour of the day in 24 hour format. Example for 3pm: k -> 15 Examples for midnight: k -> 0 kk -> 00