Java Utililty Methods SQL Date Month

List of utility methods to do SQL Date Month

Description

The list of methods to do SQL Date Month are organized into topic(s).

Method

StringgetMulmonthday(String startdate, String enddate)
get Mulmonthday
String pandy = "";
Vector tempdate = getmonthfl(startdate, enddate);
String temp[] = new String[2];
for (int i = 0; i < tempdate.size(); i++) {
    temp = (String[]) tempdate.get(i);
    pandy += temp[0] + "--" + temp[1] + ",";
if (pandy.length() > 0)
...
java.sql.DategetNextMonthFirstDate(java.sql.Date date)
get Next Month First Date
Calendar scalendar = new GregorianCalendar();
scalendar.setTime(date);
scalendar.add(Calendar.MONTH, 1);
scalendar.set(Calendar.DATE, 1);
return new java.sql.Date(scalendar.getTime().getTime());
TimestampgetNextMonthStartDate(Date date)
get Next Month Start Date
Calendar rightNow = Calendar.getInstance();
rightNow.setTime(date);
rightNow.set(Calendar.DAY_OF_MONTH, 1);
rightNow.set(Calendar.HOUR_OF_DAY, 0);
rightNow.set(Calendar.MILLISECOND, 0);
rightNow.set(Calendar.SECOND, 0);
rightNow.set(Calendar.MINUTE, 0);
rightNow.set(Calendar.MONTH, rightNow.get(Calendar.MONTH) + 1);
...
java.sql.DategetSqlDate(final int iDay, final int iMonth, final int iYear)
Returns a java.sql.Date instance for the given day, month and year
Calendar cal = Calendar.getInstance();
cal.set(iYear, iMonth - 1, iDay);
return new java.sql.Date(cal.getTimeInMillis());
DategetSqlDate(int year, int month, int day)
get Sql Date
Calendar calendar = Calendar.getInstance();
calendar.set(year, month - 1, day, 0, 0, 0);
return new Date(calendar.getTimeInMillis());
java.sql.DatenewDate(Integer year, Integer month, Integer day)
This method is a utility method to create a new java.sql.Date in one line.
if (year == null) {
    throw new IllegalArgumentException("Argument 'year' passed in was null.");
if (month == null) {
    throw new IllegalArgumentException("Argument 'month' passed in was null.");
if (day == null) {
    throw new IllegalArgumentException("Argument 'day' passed in was null.");
...
DatetoDate(int year, int month, int day)
to Date
String s = year + "-" + two(month + "") + "-" + two(day + "");
Date d = Date.valueOf(s);
return d;
java.sql.DatetoSqlDate(int year, int month, int day)
to Sql Date
String s = "" + year + "-" + two(month) + "-" + two(day);
return java.sql.Date.valueOf(s);