Java SQL Date Month getMonth(Date date)

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

Description

get Month

License

Apache License

Declaration

public static Integer getMonth(Date date) 

Method Source Code


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

import java.sql.Date;

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

public class Main {
    public static Integer getMonth(Date date) {
        return initCalendar(date).get(Calendar.MONTH) + 1;
    }/*from  w  ww  .  jav a 2  s  .  c  om*/

    private static Calendar initCalendar(Date date) {
        Calendar calendar = new GregorianCalendar();
        calendar.setTime(date);
        return calendar;
    }
}

Related

  1. getFirstDayOfNextMonth(Date date, boolean isFormatDate)
  2. getMinDayInMonth(java.sql.Date date)
  3. getMonth(final java.sql.Date date)
  4. getMonthAmount(java.sql.Date _startDate, java.sql.Date _endDate)
  5. getMonthBefroe(Date date)
  6. getMonthDate(Date myDate, int month)