Beispiel #1
0
  /**
   * Returns a string representation of <code>date</code> adjusted for <code>timezone</code>. The
   * Format is YYYY-MMM-DD hh:mm:ss z.z, where MMM is a three letter English abbreviation of the
   * month if <code>numericMonthP</code> is <code>false</code> and a two digit numeric value if
   * <code>numericMonthP</code> is <code>true</code>. The timezone as a float offset z.z is included
   * if <code>includeTimezoneP</code> is <code>true</code>.
   *
   * <p>Recommended values for the flags are <code>false</code> and <code>true</code> respectively.
   *
   * @param timezone
   * @param numericMonthP
   * @param includeTimezoneP
   * @return String
   */
  public String calendarDateToString(
      double timezone, boolean numericMonthP, boolean includeTimezoneP) {
    {
      CalendarDate date = this;

      return (date.calendarDateToDateString(timezone, numericMonthP)
          + " "
          + date.calendarDateToTimeString(timezone, includeTimezoneP, true, false));
    }
  }
Beispiel #2
0
  /**
   * Returns an ISO-8601 string representation of <code>date</code> adjusted for <code>timezone
   * </code>. The Format is YYYY-MM-DDThh:mm:ss z:zz. The timezone as an offset hh:mm is included if
   * <code>includeTimezoneP</code> is <code>true</code>.
   *
   * <p>Recommended values for the flag is <code>true</code>.
   *
   * @param timezone
   * @param includeTimezoneP
   * @return String
   */
  public String calendarDateToIso8601String(double timezone, boolean includeTimezoneP) {
    {
      CalendarDate date = this;

      {
        String tzString = "";

        if (includeTimezoneP) {
          if (timezone == 0.0) {
            tzString = "Z";
          } else {
            tzString = Stella.timeZoneFormat60(timezone);
          }
        }
        return (date.calendarDateToDateString(timezone, true)
            + "T"
            + date.calendarDateToTimeString(timezone, false, false, true)
            + tzString);
      }
    }
  }