Java Date Start getStartDate(Date date)

Here you can find the source of getStartDate(Date date)

Description

get Start Date

License

Open Source License

Declaration

public static Date getStartDate(Date date) 

Method Source Code

//package com.java2s;

import java.util.Calendar;

import java.util.Date;

public class Main {
    public static Date getStartDate(Date date) {
        return getFirstOfMonthCalendar(date).getTime();
    }//from   ww w.j  a v a 2s  .  c  o  m

    public static Calendar getFirstOfMonthCalendar(Date date) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        calendar.set(Calendar.DAY_OF_MONTH, 1);
        calendar.set(Calendar.HOUR_OF_DAY, 0);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);
        calendar.set(Calendar.MILLISECOND, 0);
        return calendar;
    }
}

Related

  1. getStart(Date date)
  2. getStartDate(Date date)
  3. getStartDate(Date date)
  4. getStartDate(String date)
  5. getStartDateOfCurrentSemester()
  6. getStartDateOfCurrMonth()