Here you can find the source of toDate(int year, int month, int day)
public static Date toDate(int year, int month, int day)
//package com.java2s; //License from project: Open Source License import java.sql.Date; public class Main { public static Date toDate(int year, int month, int day) { String s = year + "-" + two(month + "") + "-" + two(day + ""); Date d = Date.valueOf(s); return d; }// ww w . j av a 2 s .co m public static String two(String msg) { return msg.trim().length() < 2 ? "0" + msg : msg.trim(); } }