/** * convert this recurringDuration into a local Date * <p> * Note : Be aware a the 'local' property of the date i.e <tt>toDate()</tt> will de the conversion * between a UTC date and your computer date format. For instance if you have set up your computer * time zone on the Pacific Day Time the conversion of <tt>2000-10-20T00:00:00.000</tt> into a * <tt>java.util.Date</tt> will return <tt>Thu Oct 19 17:00:00 PDT 2000</tt> * * @return a local date representing this recurringDuration * @throws ParseException */ public Date toDate() throws ParseException { Date date = null; SimpleDateFormat df = new SimpleDateFormat(DATE_FORMAT); SimpleTimeZone timeZone = new SimpleTimeZone(0, "UTC"); // Set the time zone if (!isUTC()) { int offset = 0; offset = ((this.getZoneMinute() + this.getZoneHour() * 60) * 60 * 1000); offset = isZoneNegative() ? -offset : offset; timeZone.setRawOffset(offset); timeZone.setID(TimeZone.getAvailableIDs(offset)[0]); } df.setTimeZone(timeZone); date = df.parse(this.toPrivateString()); return date; }// toDate()
/** * convert this recurringDuration into a local Date * <p>Note : Be aware a the 'local' property of the date i.e <tt>toDate()</tt> will de the * conversion between a UTC date and your computer date format. * For instance if you have set up your computer time zone on the Pacific Day Time * the conversion of <tt>2000-10-20T00:00:00.000</tt> into a <tt>java.util.Date</tt> * will return <tt>Thu Oct 19 17:00:00 PDT 2000</tt> * @return a local date representing this recurringDuration * @throws ParseException */ public Date toDate() throws ParseException { Date date = null; SimpleDateFormat df = new SimpleDateFormat(DATE_FORMAT); SimpleTimeZone timeZone = new SimpleTimeZone(0,"UTC"); // Set the time zone if ( !isUTC() ) { int offset = 0; offset = ( (this.getZoneMinute() + this.getZoneHour()*60)*60*1000); offset = isZoneNegative() ? -offset : offset; timeZone.setRawOffset(offset); timeZone.setID(TimeZone.getAvailableIDs(offset)[0]); } df.setTimeZone(timeZone); date = df.parse(this.toPrivateString()); return date; }//toDate()
if ((this.getZoneHour()/10) == 0) timeZone.append(0); timeZone.append(this.getZoneHour());
if ((this.getZoneHour() / 10) == 0) timeZone.append(0); timeZone.append(this.getZoneHour());
/** * returns an array of short with all the fields which describe * a RecurringDuration * @return an array of short with all the fields which describe * a RecurringDuration */ public short[] getValues() { short[] result = null; result = new short[10]; result[0] = this.getCentury(); result[1] = this.getYear(); result[2] = this.getMonth(); result[3] = this.getDay(); result[4] = this.getHour(); result[5] = this.getMinute(); result[6] = this.getSeconds(); result[7] = this.getMilli(); result[8] = this.getZoneHour(); result[5] = this.getZoneMinute(); return result; } //getValues
/** * returns an array of short with all the fields which describe a RecurringDuration * * @return an array of short with all the fields which describe a RecurringDuration */ public short[] getValues() { short[] result = null; result = new short[10]; result[0] = this.getCentury(); result[1] = this.getYear(); result[2] = this.getMonth(); result[3] = this.getDay(); result[4] = this.getHour(); result[5] = this.getMinute(); result[6] = this.getSeconds(); result[7] = this.getMilli(); result[8] = this.getZoneHour(); result[5] = this.getZoneMinute(); return result; } // getValues
/** * Sets the value of the field associated with this descriptor. * * @param target the object in which to set the value * @param value the value of the field */ public void setValue(Object target, Object value) throws java.lang.IllegalStateException { if (!(target instanceof RecurringDuration)) { // -- throw exception } RecurringDuration recurTarget = (RecurringDuration) target; if (value == null) { /// do something } // -- update current instance of time with new time try { RecurringDuration temp = RecurringDuration.parseRecurringDuration(value.toString()); recurTarget.setCentury(temp.getCentury()); recurTarget.setYear(temp.getYear()); recurTarget.setMonth(temp.getMonth()); recurTarget.setDay(temp.getDay()); recurTarget.setHour(temp.getHour()); recurTarget.setMinute(temp.getMinute()); recurTarget.setSecond(temp.getSeconds(), temp.getMilli()); recurTarget.setZone(temp.getZoneHour(), temp.getZoneMinute()); recurTarget.isUTC(); } catch (Exception ex) { // -- ignore for now } } // -- setValue
recurTarget.setMinute(temp.getMinute()); recurTarget.setSecond(temp.getSeconds(), temp.getMilli()); recurTarget.setZone(temp.getZoneHour(),temp.getZoneMinute()); recurTarget.isUTC(); } catch (Exception ex) {
if (!reccD.isUTC()) { result = result && (!this.isUTC()); result = result && (this.getZoneHour() == reccD.getZoneHour()); result = result && (this.getZoneMinute() == reccD.getZoneMinute());
if (!reccD.isUTC()) { result = result && (!this.isUTC()); result = result && (this.getZoneHour() == reccD.getZoneHour()); result = result && (this.getZoneMinute() == reccD.getZoneMinute());