get Starting Time Of the Day - Android java.util

Android examples for java.util:Day

Description

get Starting Time Of the Day

Demo Code

import android.text.TextUtils;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;

public class Main{

    public static long getFirstTimeOfDay() {
        Date date = null;//  w  w w.ja  v a 2 s .  co  m
        try {
            String currentDate = getCurrentDate(dateFormatYMD);
            date = getDateByFormat(currentDate + " 00:00:00",
                    dateFormatYMDHMS);
            return date.getTime();
        } catch (Exception e) {
        }
        return -1;
    }

}

Related Tutorials