Java SQL Date Month getMonthDays(java.sql.Date date)

Here you can find the source of getMonthDays(java.sql.Date date)

Description

get Month Days

License

Apache License

Declaration

public static java.sql.Date[] getMonthDays(java.sql.Date date) 

Method Source Code

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

import java.util.Calendar;

public class Main {

    public static java.sql.Date[] getMonthDays(java.sql.Date date) {

        Calendar cale = Calendar.getInstance();
        cale.setTime(date);//w  w  w. j av a2 s.com

        int today = cale.get(Calendar.DAY_OF_MONTH);
        int days = cale.getActualMaximum(Calendar.DAY_OF_MONTH);
        long millis = cale.getTimeInMillis();

        java.sql.Date dates[] = new java.sql.Date[days];
        for (int i = 1; i <= days; i++) {
            long sub = (today - i) * 24 * 60 * 60 * 1000L;
            dates[i - 1] = new java.sql.Date(millis - sub);
        }

        cale = null;
        return dates;
    }
}

Related

  1. getMonth(Date date)
  2. getMonth(final java.sql.Date date)
  3. getMonthAmount(java.sql.Date _startDate, java.sql.Date _endDate)
  4. getMonthBefroe(Date date)
  5. getMonthDate(Date myDate, int month)
  6. getMonthFromYMD(Date ymd)
  7. getMonthStart(Date stamp)
  8. getMulmonthday(String startdate, String enddate)
  9. getNextMonthFirstDate(java.sql.Date date)