Android Day Get getDayStartTime(long time)

Here you can find the source of getDayStartTime(long time)

Description

get Day Start Time

Declaration

public static long getDayStartTime(long time) 

Method Source Code

//package com.java2s;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;

public class Main {
    public static long getDayStartTime(long time) {
        Calendar cal = Calendar.getInstance();
        cal.setTimeInMillis(time);//w  ww.  j a  va2 s .  c  o  m
        SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
        String strDay = sf.format(cal.getTime());
        long result;
        try {
            result = sf.parse(strDay).getTime();
        } catch (ParseException e) {
            result = time;
        }
        return result;
    }
}

Related

  1. lastDay(Date date)
  2. firstDay(Date date)
  3. getDay(long dateTimeMillis)
  4. getDaySelect(String selectName, String value, boolean hasBlank)