Here you can find the source of createDateObject(Integer year, Integer month, Integer dayOfMonth, Integer hourOfDay, Integer minute, Integer second, Integer milissecond)
Parameter | Description |
---|---|
year | a parameter |
month | a parameter |
dayOfMonth | a parameter |
hourOfDay | a parameter |
minute | a parameter |
second | a parameter |
milissecond | a parameter |
public static Date createDateObject(Integer year, Integer month, Integer dayOfMonth, Integer hourOfDay, Integer minute, Integer second, Integer milissecond)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; public class Main { /**//from ww w . j ava 2 s . c om * Create a Date object based on default Calendar instance. * * @param year * @param month * @param dayOfMonth * @param hourOfDay * @param minute * @param second * @param milissecond * @return */ public static Date createDateObject(Integer year, Integer month, Integer dayOfMonth, Integer hourOfDay, Integer minute, Integer second, Integer milissecond) { Calendar c = Calendar.getInstance(); c.set(Calendar.YEAR, year); c.set(Calendar.MONTH, month); c.set(Calendar.DAY_OF_MONTH, dayOfMonth); if (hourOfDay != null) { c.set(Calendar.HOUR_OF_DAY, hourOfDay); } if (minute != null) { c.set(Calendar.MINUTE, minute); } if (second != null) { c.set(Calendar.SECOND, second); } if (milissecond != null) { c.set(Calendar.MILLISECOND, milissecond); } return c.getTime(); } }