Java Date Start getStartTimeByManDay(Date serviceStartTime)

Here you can find the source of getStartTimeByManDay(Date serviceStartTime)

Description

get Start Time By Man Day

License

Apache License

Declaration

public static Date getStartTimeByManDay(Date serviceStartTime) 

Method Source Code

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

import java.util.Calendar;
import java.util.Date;

public class Main {

    public static Date getStartTimeByManDay(Date serviceStartTime) {
        if (serviceStartTime == null) {
            return null;
        }// w  ww. jav a2 s. c om
        Calendar startTime = Calendar.getInstance();
        startTime.setTime(serviceStartTime);
        startTime.set(Calendar.MINUTE, 0);
        startTime.set(Calendar.SECOND, 0);
        startTime.set(Calendar.MILLISECOND, 0);
        int startHour = startTime.get(Calendar.HOUR_OF_DAY);
        if (startHour >= 12) {
            startTime.set(Calendar.HOUR_OF_DAY, 12);
        } else {
            startTime.set(Calendar.HOUR_OF_DAY, 0);
        }
        return startTime.getTime();
    }
}

Related

  1. getStartOfDay(Date day)
  2. getStartOfMonth(Date date)
  3. getStartOfMonth(Date dt)
  4. getStartOfMonth(Date dt)
  5. getStartOfQuarter(Date dt)
  6. getStartTimeOfDate(Date date)
  7. getStartTimeOfDay(Date date)
  8. getStartTimeOfDay(Date date)
  9. getStrDateToDate(String dateStr)