Java SQL Date Get getDateByYearAndMonth(int year, int month)

Here you can find the source of getDateByYearAndMonth(int year, int month)

Description

get Date By Year And Month

License

Apache License

Declaration

public static Date getDateByYearAndMonth(int year, int month) 

Method Source Code


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

import java.sql.Date;

import java.util.Calendar;

public class Main {
    /**/* www .j a  v a  2s.c  o  m*/
     * 
    * get a date by year and month
    * @param year
    * @param month
    * @return
    * Date  
    * @throws
     */
    public static Date getDateByYearAndMonth(int year, int month) {
        Calendar calendar = Calendar.getInstance();
        calendar.set(Calendar.YEAR, year);
        calendar.set(Calendar.MONTH, month - 1);
        Date date = new Date(calendar.getTimeInMillis());
        return date;
    }
}

Related

  1. getDateAsLong(ResultSet rset, Enum field)
  2. getDateAsLong(Timestamp date)
  3. getDateBefore(Date date, Integer before)
  4. getDateBeforTwelveMonth()
  5. getDateByNum(String dateNum)
  6. getDateDiscrepancy(String startDate, String endDate)
  7. getDateEnd(Date date)
  8. getDateForStr(String str)
  9. getDateFromISODateString(String isoDate)