Here you can find the source of getDayOfMonth(Date date)
public static short getDayOfMonth(Date date)
//package com.java2s; //License from project: Apache License import java.util.Calendar; import java.util.Date; public class Main { public static short getDayOfMonth(Date date) { assertDateParamsRequired(date);/*ww w. j av a2s .com*/ Calendar c = Calendar.getInstance(); c.setTime(date); return (short) c.get(Calendar.DAY_OF_MONTH); } private static void assertDateParamsRequired(Date... dates) { for (Date date : dates) { if (date == null) { throw new IllegalArgumentException("The Date type parameters are required."); } } } }