Java SQL Date Month toSqlDate(int year, int month, int day)

Here you can find the source of toSqlDate(int year, int month, int day)

Description

to Sql Date

License

Open Source License

Declaration

public static java.sql.Date toSqlDate(int year, int month, int day) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static java.sql.Date toSqlDate(int year, int month, int day) {
        //SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
        String s = "" + year + "-" + two(month) + "-" + two(day);
        return java.sql.Date.valueOf(s);
    }//from w ww  .  j  av  a2  s .c  o m

    public static String two(int tt) {
        String ss = "";
        return (tt + "").length() > 1 ? (tt + "") : "0" + tt;
    }
}

Related

  1. getNextMonthStartDate(Date date)
  2. getSqlDate(final int iDay, final int iMonth, final int iYear)
  3. getSqlDate(int year, int month, int day)
  4. newDate(Integer year, Integer month, Integer day)
  5. toDate(int year, int month, int day)