get Current Date - Android java.util

Android examples for java.util:Date

Description

get Current Date

Demo Code

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.Log;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;

public class Main{

    public static Date getCurrentDate() {

        Calendar cal = Calendar.getInstance();
        Date currentDate = cal.getTime();

        return currentDate;
    }/* w ww  .j av a 2s  .co m*/

}

Related Tutorials