customized digital clock in android
hi i want to display time in my application in the format of HH:mm AM/PM. Digital clock includes seconds also. That is开发者_高级运维 HH:mm:ss am/pm. how to avoid showing seconds. Is there any possible way. Kindly help me out.
You have to make a clone of the file DigitalClock.java
to use in your application, modify in the following manner:-
private final static String m12 = "h:mm aa";
private final static String m24 = "k:mm";
The path of DigitalClock.java :
Here
import java.text.DateFormat;
import java.text.SimpleDateFormat;
// ...
DateFormat format = new SimpleDateFormat("HH:mm a");
String formatted = format.format(myDate);
精彩评论