Java Utililty Methods SQL Date Create

List of utility methods to do SQL Date Create

Description

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

Method

ObjectgetLastDayOfPreviousMonth(Date date, boolean isFormatDate)
get Last Day Of Previous Month
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.set(Calendar.MONDAY, calendar.get(Calendar.MONTH) - 1);
calendar.set(Calendar.HOUR_OF_DAY, 23);
calendar.set(Calendar.MINUTE, 59);
calendar.set(Calendar.SECOND, 59);
if (isFormatDate)
    return formatDate(getLastDayOfMonth(calendar.getTime()));
...
CalendargetLastSundayDate()
Gets the last sunday date.
Calendar cal = Calendar.getInstance();
int daydiff = cal.get(Calendar.DAY_OF_WEEK) - Calendar.SUNDAY;
cal.add(Calendar.DATE, daydiff * -1);
return cal;
LonggetLongDate(String strDate)
get Long Date
Date date = java.sql.Date.valueOf(strDate);
Long lDate = new Long(date.getTime());
return (lDate);
java.sql.TimestampgetSqlCurrentDate()
Get the current timestamp in SQL timestamp
java.util.Date today = new java.util.Date();
return new java.sql.Timestamp(today.getTime());
java.sql.DategetSqlCurrentDate()
get Sql Current Date
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
java.util.Date d = sdf.parse(sdf.format(new java.util.Date()));
return new java.sql.Date(d.getTime());
java.sql.DategetSqlDate()
get Sql Date
return new java.sql.Date(getTime());
java.sql.DategetSQLDate()
Method getSQLDate.
Calendar caldate = Calendar.getInstance();
int day = caldate.get(Calendar.DATE);
int month = caldate.get(Calendar.MONTH);
int year = caldate.get(Calendar.YEAR);
java.sql.Date sqldate = getSQLDate(year, month, day);
return sqldate;
java.sql.DategetSqlDate()
get Sql Date
return new java.sql.Date(getTime());
java.sql.DateGetSqlDate()
Get Sql Date
Date cDate = new Date();
return new java.sql.Date(cDate.getTime());
DategetSysDate()
get Sys Date
return new Date(Calendar.getInstance().getTime().getTime());