Get current Time in yyyy/MM/dd HH:mm format using SimpleDateFormat - Android java.util

Android examples for java.util:Date Format

Description

Get current Time in yyyy/MM/dd HH:mm format using SimpleDateFormat

Demo Code

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class Main{

    public static String currentTime() {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm");
        return sdf.format(new Date());
    }// w w  w  .  j  a v  a2s  . c  o  m

}

Related Tutorials