How can I get current date in Android?

I wrote the following code

Date d = new Date();
CharSequence s  = DateFormat.format("MMMM d, yyyy ", d.getTime());

I want the current date in string format, like

28-Dec-2011

so that I can set it into a TextView.

30 Answers
30

Leave a Comment