List of utility methods to do SQL Date
void | calcLastMonth(String begin, String end, String now, GregorianCalendar calendar) calc Last Month calendar.set(calendar.get(GregorianCalendar.YEAR), calendar.get(GregorianCalendar.MONTH), 1); calendar.add(GregorianCalendar.DATE, -1); int month = calendar.get(GregorianCalendar.MONTH) - 1; int d = new Date().getDate(); begin = calendar.get(GregorianCalendar.YEAR) + "-" + month + "-" + d; System.out.println(" begin: " + begin); System.out.println(" ---------------------- "); |
void | calcThisMonth(String begin, String end, String now, GregorianCalendar calendar) calc This Month end = now; int dayOfMonth = calendar.get(GregorianCalendar.DATE); calendar.add(GregorianCalendar.DATE, -dayOfMonth + 1); begin = new java.sql.Date(calendar.getTime().getTime()).toString(); System.out.println(" begin: " + begin); System.out.println(" end: " + end); System.out.println(" ---------------------- "); |
boolean | canConvert(Class> clz) Returns true if the given class can be converted. return TRANSFERABLES.contains(clz);
|
Object | convert(Class> propertyType, Object value, String propertyName) convert if (value == null || propertyType.isAssignableFrom(value.getClass())) { return value; if ((byte.class.equals(propertyType) || Byte.class.equals(propertyType)) && value.getClass().isArray()) { return value; } else if (value.getClass().isArray()) { Object[] valuesArray = (Object[]) value; if (propertyType.isArray()) { ... |
Object | convert(Object o) convert if (o == null) return o; if (o instanceof java.sql.Date) return new java.util.Date(((java.sql.Date) o).getTime()); return o; |
Comparable> | convertTo(Class> clazz, Object obj) convert To if (obj == null) { return null; if (clazz.isAssignableFrom(obj.getClass())) { return (Comparable<?>) obj; if (clazz.isPrimitive()) { if (clazz.equals(Long.TYPE)) { ... |
Comparable> | convertTo(final Class convert To if (obj == null) { return null; if (clazz.isAssignableFrom(obj.getClass())) { return (Comparable<?>) obj; final String oStr = String.valueOf(obj); if (clazz.equals(String.class)) { ... |
List | getClasses() get Classes List<Class<?>> toRet = new ArrayList<Class<?>>(); toRet.add(Collection.class); toRet.add(Comparator.class); toRet.add(Deque.class); toRet.add(Enumeration.class); toRet.add(EventListener.class); toRet.add(Formattable.class); toRet.add(Iterator.class); ... |
int | getCurrDay() get Curr Day Calendar cal = Calendar.getInstance(Locale.CHINA);
cal.setTime(getNowDate());
return cal.get(5);
|
String | getCurrentYear() This method should return the current year java.sql.Date date = new java.sql.Date(System.currentTimeMillis()); java.text.SimpleDateFormat out = new java.text.SimpleDateFormat("yyyymmdd"); return out.format(date).substring(0, 4); |