Here you can find the source of getMonth(Date date)
Parameter | Description |
---|---|
date | Date |
public static int getMonth(Date date)
//package com.java2s; //License from project: Apache License import java.util.*; public class Main { /**// w w w.jav a 2 s. c o m * @param date Date * @return int month number 0-based */ public static int getMonth(Date date) { GregorianCalendar calendar = (GregorianCalendar) GregorianCalendar.getInstance(); long time = date.getTime(); calendar.setTimeInMillis(time); return calendar.get(calendar.MONTH); } }