I'm new to both Java and Android development so this might be a stupid question, but I've been searching for days now and can't find a solution:
I try to output a java.util.Date
depending on the user's locale.
Searching on StackOverflow lead me to this:
java.util.Date date = new Date();
String dateString = DateFormat.getDateFormat(getApplicationContext()).format(date);
This outputs:
20/02/2011
On my french localized phone. Almost fine.
How can I also output the hours, minutes and seconds parts of the Date
, using the user's locale ? I've been looking in the android documentation but couldn't find anything.
Many thanks.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…