m -= 12; return dateValue(y, m + 3, (int) d);
/** * Parse a date string. The format is: [+|-]year-month-day * * @param s the string to parse * @param start the parse index start * @param end the parse index end * @return the date value * @throws IllegalArgumentException if there is a problem */ public static long parseDateValue(String s, int start, int end) { if (s.charAt(start) == '+') { // +year start++; } // start at position 1 to support "-year" int s1 = s.indexOf('-', start + 1); int s2 = s.indexOf('-', s1 + 1); if (s1 <= 0 || s2 <= s1) { throw new IllegalArgumentException(s); } int year = Integer.parseInt(s.substring(start, s1)); int month = Integer.parseInt(s.substring(s1 + 1, s2)); int day = Integer.parseInt(s.substring(s2 + 1, end)); if (!isValidDate(year, month, day)) { throw new IllegalArgumentException(year + "-" + month + "-" + day); } return dateValue(year, month, day); }
DateTimeUtils.dateValue(1970, 1, 1)); case TIMESTAMP: return ValueDate.fromDateValue(