Пример #1
0
  /**
   * Returns a calendar date object representing the date and time parsed from the <code>input
   * </code> string. If no valid parse is found, <code>null</code> is returned.
   *
   * @param input
   * @return CalendarDate
   */
  public static CalendarDate stringToCalendarDate(String input) {
    {
      DecodedDateTime dateTime =
          DecodedDateTime.parseDateTimeInTimeZone(
              input, Stella.NULL_FLOAT, 0, Stella.NULL_INTEGER, false);

      if (dateTime == null) {
        return (null);
      } else {
        return (dateTime.encodeCalendarDate());
      }
    }
  }
Пример #2
0
  /**
   * Returns a calendar date object representing the date and time parsed from the <code>inputDate
   * </code> string. Default values for missing fields and the interpretation of relative references
   * come from <code>defaultDate</code>. If the <code>defaultDate</code> is <code>null</code>, the
   * current date will be used. If a null set of defaults is desired, use <code>
   * $NULL_DECODED_DATE_TIME$</code>. If no valid parse is found, <code>null</code> is returned.
   *
   * @param inputDate
   * @param defaultDate
   * @return CalendarDate
   */
  public static CalendarDate stringToCalendarDateWithDefault(
      String inputDate, DecodedDateTime defaultDate) {
    if (defaultDate == null) {
      return (CalendarDate.stringToCalendarDate(inputDate));
    } else {
      {
        DecodedDateTime dateTime =
            DecodedDateTime.parseDateTimeRelativeToBase(
                inputDate, defaultDate, 0, Stella.NULL_INTEGER, false, true);

        if (dateTime == null) {
          return (null);
        } else {
          return (dateTime.encodeCalendarDate());
        }
      }
    }
  }
Пример #3
0
  /**
   * Returns a decoded time object for <code>date</code> interpreted in <code>timezone</code> <code>
   * timezone</code> is the number of hours added to UTC to get local time. It is in the range -12.0
   * to +14.0 where UTC is zone 0.0
   *
   * @param timezone
   * @return DecodedDateTime
   */
  public DecodedDateTime decodeCalendarDate(double timezone) {
    {
      CalendarDate date = this;

      {
        int hour = Stella.NULL_INTEGER;
        int min = Stella.NULL_INTEGER;
        int sec = Stella.NULL_INTEGER;
        int millis = Stella.NULL_INTEGER;

        {
          Object[] caller_MV_returnarray = new Object[3];

          hour = date.getTime(timezone, caller_MV_returnarray);
          min = ((int) (((IntegerWrapper) (caller_MV_returnarray[0])).wrapperValue));
          sec = ((int) (((IntegerWrapper) (caller_MV_returnarray[1])).wrapperValue));
          millis = ((int) (((IntegerWrapper) (caller_MV_returnarray[2])).wrapperValue));
        }
        {
          int year = Stella.NULL_INTEGER;
          int month = Stella.NULL_INTEGER;
          int day = Stella.NULL_INTEGER;
          Keyword dow = null;

          {
            Object[] caller_MV_returnarray = new Object[3];

            year = date.getCalendarDate(timezone, caller_MV_returnarray);
            month = ((int) (((IntegerWrapper) (caller_MV_returnarray[0])).wrapperValue));
            day = ((int) (((IntegerWrapper) (caller_MV_returnarray[1])).wrapperValue));
            dow = ((Keyword) (caller_MV_returnarray[2]));
          }
          {
            DecodedDateTime self000 = DecodedDateTime.newDecodedDateTime();

            self000.dateTimeMillis = ((double) (millis));
            self000.dateTimeSecond = sec;
            self000.dateTimeMinute = min;
            self000.dateTimeHour = hour;
            self000.dateTimeDay = day;
            self000.dateTimeMonth = month;
            self000.dateTimeYear = year;
            self000.dateTimeZone = timezone;
            self000.dateTimeDow = dow;
            {
              DecodedDateTime value000 = self000;

              return (value000);
            }
          }
        }
      }
    }
  }