List of utility methods to do SQL Date
Date | getDayOfPerMonth(String theDataStr) get Day Of Per Month Date theDate = java.sql.Date.valueOf(theDataStr); Calendar c = new GregorianCalendar(); c.setTime(theDate); int day = c.get(Calendar.DAY_OF_MONTH); if (day <= 10) { c.set(Calendar.DAY_OF_MONTH, 1); } else if (day > 10 && day <= 20) { c.set(Calendar.DAY_OF_MONTH, 11); ... |
int | getDiffDays(String begin_dt, String end_dt) get Diff Days Date end = java.sql.Date.valueOf(end_dt); Date begin = java.sql.Date.valueOf(begin_dt); int days = getDaysBetween(begin, end); return days; |
List | getEndWeekDayOfMonth(String year, String month) get End Week Day Of Month List list = new ArrayList(); String date = ""; int days = daysInMonth(year, month); int weekday = 0; for (int i = 1; i <= days; i++) { weekday = getWeekOfMonth(year, month, String.valueOf(i)); if (weekday == 5) { if (i < 10) { ... |
String | getFileName() get File Name String fileName = ""; SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss"); Date curDate = new Date(System.currentTimeMillis()); fileName = formatter.format(curDate) + ".png"; return fileName; |
String | getFirstDayOfNextMonth() get First Day Of Next Month try { return increaseYearMonth(getNowShortDate().substring(0, 6)) + "01"; } catch (Exception e) { return ""; |
String | getFirstDayOfThisMonth() get First Day Of This Month try { return getNowShortDate().substring(0, 6) + "01"; } catch (Exception e) { return ""; |
String | getInsertarEmpleado() get Insertar Empleado return "INSERT INTO tblempleado( id_empleado, nombre, apellidos, fecha_n, telefono, direccion, email, estado, id_cargo, id_empresa) values (?,?,?,?,?,?,?,?,?,?)"; |
String | getInsertarEntrada() get Insertar Entrada return "INSERT INTO tblentrada_salida( id_empleado, cons, hora_entrada, hora_salida, fecha, id_empresa) values (?,?,?,?,?,?)"; |
long | getIntervalDays(String sd, String ed) get Interval Days return ((java.sql.Date.valueOf(ed)).getTime() - (java.sql.Date.valueOf(sd)).getTime()) / (3600 * 24 * 1000);
|
String | getLastDay() get Last Day Calendar c = Calendar.getInstance(); c.setTime(getNowDate()); int today = c.get(5); c.set(5, today - 1); String lastDay = new SimpleDateFormat("yyyyMMdd").format(c.getTime()); return lastDay; |