Java Date to Month getMonth(java.util.Date date)

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

Description

get Month

License

Open Source License

Declaration

public static java.util.Date[] getMonth(java.util.Date date) 

Method Source Code

//package com.java2s;

public class Main {

    public static java.util.Date[] getMonth(java.util.Date date) {
        java.util.Calendar cal = java.util.Calendar.getInstance();
        cal.setTime(date);/*  w ww  .  ja v  a2 s .  co m*/
        int lastDay = cal.getActualMaximum(java.util.Calendar.DAY_OF_MONTH);
        cal.set(java.util.Calendar.DAY_OF_MONTH, 1);
        java.util.Date begin = cal.getTime();
        cal.set(java.util.Calendar.DAY_OF_MONTH, lastDay);
        java.util.Date end = cal.getTime();
        return new java.util.Date[] { begin, end };
    }
}

Related

  1. getMonth(Date date)
  2. getMonth(Date date)
  3. getMonth(Date dateParam)
  4. getMonth(Date... objects)
  5. getMonth(java.util.Date date)
  6. getMonth(java.util.Date date)
  7. getMonth(java.util.Date today)
  8. getMonth(long date, int increment)
  9. getMonth(String strDate)