Here you can find the source of getYearMonthDay(final int year, final int month, final int day)
Parameter | Description |
---|---|
year | a parameter |
month | a parameter |
day | a parameter |
public static Date getYearMonthDay(final int year, final int month, final int day)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; public class Main { /**//from w ww . j a v a 2s . c o m * Return normalized year month day date (desired day in month at 00:00:00.000 * pm) * * @param year * @param month * @param day * @return */ public static Date getYearMonthDay(final int year, final int month, final int day) { final Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.YEAR, year); calendar.set(Calendar.MONTH, month - 1); calendar.set(Calendar.DAY_OF_MONTH, day); // normalize time to 00:00:00.000 pm calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); return calendar.getTime(); } }