示例#1
0
 private static XMLGregorianCalendar stripCalendar(XMLGregorianCalendar calendar) {
   calendar = (XMLGregorianCalendar) calendar.clone();
   calendar.setYear(DatatypeConstants.FIELD_UNDEFINED);
   calendar.setMonth(DatatypeConstants.FIELD_UNDEFINED);
   calendar.setHour(DatatypeConstants.FIELD_UNDEFINED);
   calendar.setMinute(DatatypeConstants.FIELD_UNDEFINED);
   calendar.setSecond(DatatypeConstants.FIELD_UNDEFINED);
   calendar.setMillisecond(DatatypeConstants.FIELD_UNDEFINED);
   return calendar;
 }
示例#2
0
  public ConstrainByDate writeTimeConstrain() {
    ConstrainByDate timeConstrain = new ConstrainByDate();
    DTOFactory dtoFactory = new DTOFactory();

    TimeZone tz = Calendar.getInstance().getTimeZone();
    GregorianCalendar cal = new GregorianCalendar(tz);
    // cal.get(Calendar.ZONE_OFFSET);
    int zt_offset = (cal.get(Calendar.ZONE_OFFSET) + cal.get(Calendar.DST_OFFSET)) / 60000;
    // log.info("Timezone: "+tz.getID()+" : "+zt_offset);

    if (startTime() != -1) {
      ConstrainDateType constraindateType = new ConstrainDateType();
      XMLGregorianCalendar xmlC =
          dtoFactory.getXMLGregorianCalendarDate(startYear(), startMonth() + 1, startDay());
      xmlC.setTimezone(zt_offset); // 0);//-5*60);
      xmlC.setHour(0);
      xmlC.setMinute(0);
      xmlC.setSecond(0);
      constraindateType.setValue(xmlC);
      timeConstrain.setDateFrom(constraindateType);
    }

    if (endTime() != -1) {
      ConstrainDateType constraindateType = new ConstrainDateType();
      XMLGregorianCalendar xmlC =
          dtoFactory.getXMLGregorianCalendarDate(endYear(), endMonth() + 1, endDay());
      xmlC.setTimezone(zt_offset); // 0);//-5*60);
      xmlC.setHour(0);
      xmlC.setMinute(0);
      xmlC.setSecond(0);
      constraindateType.setValue(xmlC);
      timeConstrain.setDateTo(constraindateType);
    }

    return timeConstrain;
  }
示例#3
0
 public void setHour(int hour) {
   calendar.setHour(hour);
 }