Java examples for java.util:Day
new Date For Day
//package com.java2s; import java.util.Calendar; import java.util.Date; public class Main { public static void main(String[] argv) throws Exception { int year = 2; int month = 2; int day = 2; System.out.println(newDateForDay(year, month, day)); }// ww w . j a v a 2s . c om public static Date newDateForDay(int year, int month, int day) { Calendar cal = Calendar.getInstance(); cal.set(Calendar.YEAR, year); cal.set(Calendar.MONTH, month + 1); cal.set(Calendar.DAY_OF_MONTH, day); cal.set(Calendar.HOUR, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); return cal.getTime(); } }