Java BigDecimal getEndTimeByManDay(Date serviceStartTime, BigDecimal manDay)

Here you can find the source of getEndTimeByManDay(Date serviceStartTime, BigDecimal manDay)

Description

get End Time By Man Day

License

Apache License

Declaration

public static Date getEndTimeByManDay(Date serviceStartTime, BigDecimal manDay) 

Method Source Code


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

import java.math.BigDecimal;

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

public class Main {
    public static final BigDecimal MAN_DAY = new BigDecimal("0.5");

    public static Date getEndTimeByManDay(Date serviceStartTime, BigDecimal manDay) {
        if (serviceStartTime == null) {
            return null;
        }/*  w  w w . ja va 2  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);
        }
        int hourAdd = (manDay.divide(MAN_DAY).intValue()) * 12;
        startTime.add(Calendar.HOUR_OF_DAY, hourAdd);
        return startTime.getTime();
    }
}

Related

  1. getDepositAmount(Boolean isReceipt, BigDecimal amount)
  2. getDigits(BigDecimal value)
  3. getDistance(BigDecimal sourceLatitude, BigDecimal sourceLongitude, BigDecimal destLatitude, BigDecimal destLongitude)
  4. getDividedBigDecimal(final int nDividend, final int nDivisor)
  5. getDoubleBigDecimal(String amount, int afterDot)
  6. getFloatingPoint(Console console, Function validator)
  7. getFormattedBigDecimal(BigDecimal value)
  8. getFraction(BigDecimal b)
  9. getFractionalPart(BigDecimal value)