views:

90

answers:

1

I know I can use android.text.format.DateFormat.getDateFormat() to format my dates, and android.text.format.DateFormat.getTimeFormat to format my times, but how do I format a datetime? Similar to the getDateTimeInstance method from java.text.DateFormat.

I'm currently just concatenating the result of both the getDateFormat and getTimeFormat's formatters, but I don't know which way around the user prefers to have their dates and times shown.

+2  A: 

Do you need the String representation only? If yes, please have a look at

public static String   formatDateTime  (Context context, long millis, int flags)

in: android.text.format.DateUtils

Loxley
Thanks, that's exactly what I needed.
Sverre Rabbelier