get current time in minute mm format - Android java.util

Android examples for java.util:Date Format

Description

get current time in minute mm format

Demo Code

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*/

}

Related Tutorials