Personalized digital clock in android

Hi, I want to display the time in my application in the format HH: mm AM / PM. Digital clocks also include seconds. This is HH: mm: ss am / pm. how to avoid showing seconds. Is there any possible way. Please help me.

0
source share
2 answers

You must clone the DigitalClock.java file for use in your application, modify it as follows: -

 private final static String m12 = "h:mm aa"; private final static String m24 = "k:mm"; 

Path to DigitalClock.java: Here file

+5
source
 import java.text.DateFormat; import java.text.SimpleDateFormat; // ... DateFormat format = new SimpleDateFormat("HH:mm a"); String formatted = format.format(myDate); 
0
source

All Articles