Java Date Set setMinDate(Date d)

Here you can find the source of setMinDate(Date d)

Description

set Min Date

License

Open Source License

Declaration

public static Date setMinDate(Date d) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

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

public class Main {
    public static Date setMinDate(Date d) {

        Calendar min = Calendar.getInstance();
        min.setTime(d);//  w  w w  . j ava2s  .c om
        if (min.get(Calendar.AM_PM) == Calendar.AM) {
            min.set(Calendar.HOUR, 0);
        } else {
            min.set(Calendar.HOUR, -12);
        }
        min.set(Calendar.MINUTE, min.getActualMinimum(Calendar.MINUTE));
        min.set(Calendar.SECOND, min.getActualMinimum(Calendar.SECOND));
        min.set(Calendar.MILLISECOND,
                min.getActualMinimum(Calendar.MILLISECOND));
        return min.getTime();

    }
}

Related

  1. setHour(java.util.Date date, Integer hour)
  2. setHourMinuteSecondToZeroPlus24Hours(Date datetime)
  3. setHours(Date d, int hours)
  4. setHours(Date date, int amount)
  5. setMilliSecondsToDate(Date date, Integer milliSeconds)
  6. setMinSeconds(Date date)
  7. setMinute(Date date, int minute)
  8. setMinutes(Date date, int amount)
  9. setStartDateIfNull(java.util.Date start)