Java Date Start getStartDay(Date date)

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

Description

get Start Day

License

BSD License

Declaration

public static GregorianCalendar getStartDay(Date date) 

Method Source Code

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

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

public class Main {
    private static int[] ORDERED_DATE_FIELD = new int[] {
            // DST_OFFSET
            Calendar.ZONE_OFFSET, Calendar.MILLISECOND, Calendar.SECOND, Calendar.MINUTE, Calendar.HOUR_OF_DAY,
            Calendar.DAY_OF_MONTH, Calendar.MONTH };

    public static GregorianCalendar getStartDay(Date date) {
        GregorianCalendar cal = new GregorianCalendar();
        cal.setTime(date);/*from  w  ww. jav a  2 s .com*/
        for (int field = 0; field < 5; field++)
            // reset all to Calendar.HOUR_OF_DAY
            cal.set(ORDERED_DATE_FIELD[field], 0);
        return cal;
    }
}

Related

  1. getStartDate(Date date)
  2. getStartDate(Date date)
  3. getStartDate(String date)
  4. getStartDateOfCurrentSemester()
  5. getStartDateOfCurrMonth()
  6. getStartDayOfNextMonth(Date date)
  7. getStartOfDate(final Date date)
  8. getStartOfDay(Date date)
  9. getStartOfDay(Date date)