List of utility methods to do SQL Date
long | stringToMillis(String str) string To Millis if (isAllDigits(str)) { return Long.parseLong(str); } else if (str.length() == 10) { return stringToDate(str, DEFAULT_DATE_PATTERN).getTime(); } else if (str.length() == 19) { return stringToDate(str, DEFAULT_DATETIME_PATTERN_WITHOUT_MILLISECONDS).getTime(); } else if (str.length() == 23) { return stringToDate(str, DEFAULT_DATETIME_PATTERN_WITH_MILLISECONDS).getTime(); ... |
String | toAge(String birthDay) to Age if (birthDay == null || birthDay.length() != 8) { return null; int birthYear = Integer.parseInt(birthDay.substring(0, 4)); int birthMonth = Integer.parseInt(birthDay.substring(4, 6)); int birthDayOfMonth = Integer.parseInt(birthDay.substring(6, 8)); return toAge(birthYear, birthMonth, birthDayOfMonth); |
Date | today() Gets the current date. return new Date(System.currentTimeMillis()); |
java.sql.Date | today() today return new java.sql.Date(todayCalendar().getTimeInMillis()); |
java.sql.Date | today() return current date (based on system time) as an SQL Date GregorianCalendar d = new GregorianCalendar(); return new java.sql.Date(d.getTime().getTime()); |
java.sql.Date | todaySQL() a date set at midnight return new java.sql.Date(today().getTime()); |