Standard datetime formatting in Android
suggest changeFormat a date:
Date date = new Date();
DateFormat df = DateFormat.getDateInstance(DateFormat.MEDIUM);
String localizedDate = df.format(date)
Format a date and time. Date is in short format, time is in long format:
Date date = new Date();
DateFormat df = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.LONG);
String localizedDate = df.format(date)
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents