Here you can find the source of getMonthOfYear(Date dt)
Parameter | Description |
---|---|
dt | The given Date |
public static int getMonthOfYear(Date dt)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; public class Main { /**// w w w . ja v a 2 s .c o m * Get and return the month of year from the given Date dt * * @param dt * The given Date * * @return day The int value for month of year */ public static int getMonthOfYear(Date dt) { Calendar cal = new GregorianCalendar(); cal.setTime(dt); return (cal.get(Calendar.MONTH)); } }