Here you can find the source of setField(Date date, int field, int value)
public static Date setField(Date date, int field, int value)
//package com.java2s; //License from project: LGPL import java.util.Calendar; import java.util.Date; public class Main { public static Date setField(Date date, int field, int value) { Date result = date;//w w w. ja v a 2 s .c o m if (date != null) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date); calendar.set(field, value); result = calendar.getTime(); } return result; } }