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

DategetCurrDate()
get Curr Date
DateFormat formatter = new SimpleDateFormat("yyyyMMddhhmmssSSS");
long now = System.currentTimeMillis();
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(now);
return calendar.getTime();
StringgetCurrentDate()
Get current date, format yyyy/MM/dd.
return formatDate(getCurrentTimestamp());
StringgetCurrentDate()
get Current Date
Date date = new Date(System.currentTimeMillis());
return DATE_FORMAT.format(date);
StringgetCurrentDate()
Get current date's string
return new SimpleDateFormat(DATE_FORMAT_yyyy_MM_dd).format(new Date(System.currentTimeMillis()));
DategetCurrentDate()
get Current Date
Calendar c = new GregorianCalendar();
return new Date(c.getTimeInMillis());
DategetCurrentDate()
get Current Date
java.util.Date utilDate = new java.util.Date();
return new java.sql.Date(utilDate.getTime());
java.sql.DategetCurrentDate()
get Current Date
return new java.sql.Date(new Date().getTime());
TimestampgetCurrentDate()
get Current Date
Calendar c = Calendar.getInstance();
c.set(c.get(1), c.get(2), c.get(5), 0, 0, 0);
Timestamp t = new Timestamp(c.getTime().getTime());
t.setNanos(0);
return t;
DategetCurrentDateStart()
get Current Date Start
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
return calendar.getTime();
StringgetCurrentDateStr(String strFormat)
Return the current date in the specified format
Calendar cal = Calendar.getInstance();
Date currDate = cal.getTime();
return format(currDate, strFormat);