Android examples for java.util:Date Format
get current time in minute mm format
import java.text.SimpleDateFormat; import java.util.Date; public class Main{ public static int getData_mm() { SimpleDateFormat formatter = new SimpleDateFormat("mm"); Date curDate = new Date(System.currentTimeMillis()); int str = Integer.parseInt(formatter.format(curDate).toString()); return str; }/* ww w . j a v a 2 s .c o m*/ }