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

StringgetDateAsString(int month, int date, int year)
get Date As String
StringBuffer dateAsString = new StringBuffer();
if (month > 9) {
    dateAsString.append(month);
} else {
    dateAsString.append("0" + month);
dateAsString.append(DISPLAY_DATE_DELIMITER);
if (date > 9) {
...
StringgetDateFormat()
get Date Format
return DATE_FORMAT;
StringgetDateFormat(java.util.Date date)
getting a date string like 'yyyy-MM-dd' from a java.util.Date or java.sql.Date
return getFormat(date, DATE_FORMAT_STR);
StringgetDateString(String date)
get Date String
if (date != null && date.length() > 10)
    date = date.substring(0, 10);
return date;
StringgetDateString(String pattern)
get Date String
Timestamp time = getSysDate();
DateFormat dfmt = new SimpleDateFormat(pattern);
java.util.Date date = time;
return dfmt.format(date);
StringgetDateString2()
get Date String
String format = "yyyy/MM/dd";
return getDateTimeString(format);
IntegergetDay(Date date)
get Day
return initCalendar(date).get(Calendar.DAY_OF_MONTH);
intgetDay(final java.sql.Date date)
Returns the day of the month for the given date
Calendar cal = Calendar.getInstance();
cal.setTime(date);
return cal.get(Calendar.DAY_OF_MONTH);
StringgetDay(String stringDate)
get Day
String day = "";
int checkyear = -1;
if (stringDate.trim().equals("")) {
    return "";
} else {
    int index = stringDate.indexOf("-");
    int lastIndex = stringDate.lastIndexOf("-");
    day = stringDate.substring(lastIndex + 1, lastIndex + 3);
...
DategetDayByMonthSeed(Date date, int monthSeed)
get Day By Month Seed
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.MONTH, monthSeed);
String dstr = toDateString(calendar.getTime());
return Timestamp.valueOf(dstr + " 00:00:00");