/** 返回指定日期属于全年的周数 */ public Integer evaluate(java.sql.Date d) { if (d == null) { return null; } initDateFormat(null); calendar.setTimeZone(dateParser.getTimeZone()); calendar.setTime(d); return calendar.get(Calendar.WEEK_OF_YEAR); }
/** 返回指定日期属于全年的周数 */ public Integer evaluate(Timestamp t) { if (t == null) { return null; } initDateFormat(null); calendar.setTimeZone(dateParser.getTimeZone()); calendar.setTime(t); return calendar.get(Calendar.WEEK_OF_YEAR); }
private long getTime(String dateString) throws StreamingException { if (isTimestampType) { Timestamp ts = (Timestamp) timestampParser.createValue(dateString); return ts.getTime(); } else { Date dt = (Date) dateParser.createValue(dateString); return dt.getTime(); } }
private void initDateFormat(String dateString) { calendar = Calendar.getInstance(); calendar.setFirstDayOfWeek(Calendar.MONDAY); calendar.setMinimalDaysInFirstWeek(4); if (Strings.isNullOrEmpty(dateString)) { return; } if (isTimestampType == null) { initDataType(dateString); if (isTimestampType) { calendar.setTimeZone(timestampParser.getTimeZone()); } else { calendar.setTimeZone(dateParser.getTimeZone()); } } }