Android Localized Date/Time in Android Fully customized date/time


Example

Date date = new Date();
df = new SimpleDateFormat("HH:mm", Locale.US);
String localizedDate = df.format(date)

Commonly used patterns:

  • HH: hour (0-23)
  • hh: hour (1-12)
  • a: AM/PM marker
  • mm: minute (0-59)
  • ss: second
  • dd: day in month (1-31)
  • MM: month
  • yyyy: year