Java Day of getFirstTimeInDay(Date day)

Here you can find the source of getFirstTimeInDay(Date day)

Description

get First Time In Day

License

Apache License

Declaration

public static Date getFirstTimeInDay(Date day) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.text.SimpleDateFormat;
import java.util.*;

public class Main {
    public static Date getFirstTimeInDay(Date day) {
        Calendar date = Calendar.getInstance();
        date.setTime(day);/*from  ww  w  .  ja  v a 2  s .  c om*/
        date.set(Calendar.HOUR_OF_DAY, 0);
        date.set(Calendar.MINUTE, 0);
        date.set(Calendar.SECOND, 0);
        date.set(Calendar.MILLISECOND, 0);
        return date.getTime();
    }

    public static String getTime() {
        Date currentTime = new Date();
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String dateString = formatter.format(currentTime);
        String min;
        min = dateString.substring(14, 16);
        return min;
    }
}

Related

  1. getFirstDay(boolean withTime)
  2. getFirstDay(Date date)
  3. getFirstDayInThisQuarter(String nowDate)
  4. getFirstDayOfQuarter(Date date)
  5. getFirstOfDay(Date date)
  6. getFormattedNowDatePlusDays(int days, String dateFormat)
  7. getFullAge(Date birthday)
  8. getIncrementDaysSecond(String strDate, int sec)
  9. getInsertDayDate(int days)