Example #1
0
 public Object clone() {
   DateTimeData dt =
       new DateTimeData(
           this.year,
           this.month,
           this.day,
           this.hour,
           this.minute,
           this.second,
           this.utc,
           this.originalValue,
           this.normalized,
           this.type);
   dt.canonical = this.canonical;
   dt.position = position;
   dt.timezoneHr = this.timezoneHr;
   dt.timezoneMin = this.timezoneMin;
   dt.unNormYear = this.unNormYear;
   dt.unNormMonth = this.unNormMonth;
   dt.unNormDay = this.unNormDay;
   dt.unNormHour = this.unNormHour;
   dt.unNormMinute = this.unNormMinute;
   dt.unNormSecond = this.unNormSecond;
   return dt;
 }
Example #2
0
  /**
   * Parses, validates and computes normalized version of gYearMonth object
   *
   * @param str The lexical representation of gYearMonth object CCYY-MM with possible time zone Z or
   *     (-),(+)hh:mm
   * @return normalized date representation
   * @exception SchemaDateTimeException Invalid lexical representation
   */
  protected DateTimeData parse(String str) throws SchemaDateTimeException {
    DateTimeData date = new DateTimeData(str, this);
    int len = str.length();

    // get date
    int end = getYearMonth(str, 0, len, date);
    date.day = DAY;
    parseTimeZone(str, end, len, date);

    // validate and normalize

    validateDateTime(date);

    // save unnormalized values
    saveUnnormalized(date);

    if (date.utc != 0 && date.utc != 'Z') {
      normalize(date);
    }
    date.position = 0;
    return date;
  }