Here you can find the source of toDate(final int year, final int month, final int dayOfMonth)
Parameter | Description |
---|---|
year | a parameter |
month | Month(start with 1) |
dayOfMonth | a parameter |
public static Date toDate(final int year, final int month, final int dayOfMonth)
//package com.java2s; //License from project: Apache License import java.util.Calendar; import java.util.Date; public class Main { /**//from w ww . j a va2 s.co m * create Date instance. * @param year * @param month Month(start with 1) * @param dayOfMonth * @return */ public static Date toDate(final int year, final int month, final int dayOfMonth) { return toDate(year, month, dayOfMonth, 0, 0, 0); } /** * create Date instance. * @param year * @param month Month(start with 1) * @param dayOfMonth * @param hour * @param minute * @param second * @return */ public static Date toDate(final int year, final int month, final int dayOfMonth, final int hour, final int minute, final int second) { Calendar cal = Calendar.getInstance(); cal.set(year, month - 1, dayOfMonth, hour, minute, second); cal.set(Calendar.MILLISECOND, 0); return cal.getTime(); } }