Custom localized date format with DateUtils.formatDateTime

suggest change

DateUtils.formatDateTime() allows you to supply a time, and based on the flags you provide, it creates a localized datetime string. The flags allow you to specify whether to include specific elements (like the weekday).

Date date = new Date();
String localizedDate = DateUtils.formatDateTime(context, date.getTime(), DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_WEEKDAY);

formatDateTime() automatically takes care about proper date formats.

Feedback about page:

Optional: your email if you want me to get back to you:

Table Of Contents