/** * 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()
timeZone.append(this.getZoneMinute()); if (isZoneNegative()) timeZone.insert(0,'-'); else timeZone.insert(0,'+');
timeZone.append(this.getZoneMinute()); if (isZoneNegative()) timeZone.insert(0, '-'); else