java.text.SimpleDateFormat.appendNumericTimeZone()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(9.0k)|赞(0)|评价(0)|浏览(95)

本文整理了Java中java.text.SimpleDateFormat.appendNumericTimeZone()方法的一些代码示例,展示了SimpleDateFormat.appendNumericTimeZone()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SimpleDateFormat.appendNumericTimeZone()方法的具体详情如下:
包路径:java.text.SimpleDateFormat
类名称:SimpleDateFormat
方法名:appendNumericTimeZone

SimpleDateFormat.appendNumericTimeZone介绍

暂无

代码示例

代码示例来源:origin: robovm/robovm

/**
 * Append a representation of the time zone of 'calendar' to 'buffer'.
 *
 * @param count the number of z or Z characters in the format string; "zzz" would be 3,
 * for example.
 * @param generalTimeZone true if we should use a display name ("PDT") if available;
 * false implies that we should use RFC 822 format ("-0800") instead. This corresponds to 'z'
 * versus 'Z' in the format string.
 */
private void appendTimeZone(StringBuffer buffer, int count, boolean generalTimeZone) {
  if (generalTimeZone) {
    TimeZone tz = calendar.getTimeZone();
    boolean daylight = (calendar.get(Calendar.DST_OFFSET) != 0);
    int style = count < 4 ? TimeZone.SHORT : TimeZone.LONG;
    if (!formatData.customZoneStrings) {
      buffer.append(tz.getDisplayName(daylight, style, formatData.locale));
      return;
    }
    // We can't call TimeZone.getDisplayName() because it would not use
    // the custom DateFormatSymbols of this SimpleDateFormat.
    String custom = TimeZoneNames.getDisplayName(formatData.zoneStrings, tz.getID(), daylight, style);
    if (custom != null) {
      buffer.append(custom);
      return;
    }
  }
  // We didn't find what we were looking for, so default to a numeric time zone.
  appendNumericTimeZone(buffer, count, generalTimeZone);
}

代码示例来源:origin: robovm/robovm

case RFC_822_TIMEZONE_FIELD: // 'Z'
  dateFormatField = Field.TIME_ZONE;
  appendNumericTimeZone(buffer, count, false);
  break;

代码示例来源:origin: ibinti/bugvm

/**
 * Append a representation of the time zone of 'calendar' to 'buffer'.
 *
 * @param count the number of z or Z characters in the format string; "zzz" would be 3,
 * for example.
 * @param generalTimeZone true if we should use a display name ("PDT") if available;
 * false implies that we should use RFC 822 format ("-0800") instead. This corresponds to 'z'
 * versus 'Z' in the format string.
 */
private void appendTimeZone(StringBuffer buffer, int count, boolean generalTimeZone) {
  if (generalTimeZone) {
    TimeZone tz = calendar.getTimeZone();
    boolean daylight = (calendar.get(Calendar.DST_OFFSET) != 0);
    int style = count < 4 ? TimeZone.SHORT : TimeZone.LONG;
    if (!formatData.customZoneStrings) {
      buffer.append(tz.getDisplayName(daylight, style, formatData.locale));
      return;
    }
    // We can't call TimeZone.getDisplayName() because it would not use
    // the custom DateFormatSymbols of this SimpleDateFormat.
    String custom = TimeZoneNames.getDisplayName(formatData.zoneStrings, tz.getID(), daylight, style);
    if (custom != null) {
      buffer.append(custom);
      return;
    }
  }
  // We didn't find what we were looking for, so default to a numeric time zone.
  appendNumericTimeZone(buffer, count, generalTimeZone);
}

代码示例来源:origin: com.gluonhq/robovm-rt

/**
 * Append a representation of the time zone of 'calendar' to 'buffer'.
 *
 * @param count the number of z or Z characters in the format string; "zzz" would be 3,
 * for example.
 * @param generalTimeZone true if we should use a display name ("PDT") if available;
 * false implies that we should use RFC 822 format ("-0800") instead. This corresponds to 'z'
 * versus 'Z' in the format string.
 */
private void appendTimeZone(StringBuffer buffer, int count, boolean generalTimeZone) {
  if (generalTimeZone) {
    TimeZone tz = calendar.getTimeZone();
    boolean daylight = (calendar.get(Calendar.DST_OFFSET) != 0);
    int style = count < 4 ? TimeZone.SHORT : TimeZone.LONG;
    if (!formatData.customZoneStrings) {
      buffer.append(tz.getDisplayName(daylight, style, formatData.locale));
      return;
    }
    // We can't call TimeZone.getDisplayName() because it would not use
    // the custom DateFormatSymbols of this SimpleDateFormat.
    String custom = TimeZoneNames.getDisplayName(formatData.zoneStrings, tz.getID(), daylight, style);
    if (custom != null) {
      buffer.append(custom);
      return;
    }
  }
  // We didn't find what we were looking for, so default to a numeric time zone.
  appendNumericTimeZone(buffer, count, generalTimeZone);
}

代码示例来源:origin: MobiVM/robovm

/**
 * Append a representation of the time zone of 'calendar' to 'buffer'.
 *
 * @param count the number of z or Z characters in the format string; "zzz" would be 3,
 * for example.
 * @param generalTimeZone true if we should use a display name ("PDT") if available;
 * false implies that we should use RFC 822 format ("-0800") instead. This corresponds to 'z'
 * versus 'Z' in the format string.
 */
private void appendTimeZone(StringBuffer buffer, int count, boolean generalTimeZone) {
  if (generalTimeZone) {
    TimeZone tz = calendar.getTimeZone();
    boolean daylight = (calendar.get(Calendar.DST_OFFSET) != 0);
    int style = count < 4 ? TimeZone.SHORT : TimeZone.LONG;
    if (!formatData.customZoneStrings) {
      buffer.append(tz.getDisplayName(daylight, style, formatData.locale));
      return;
    }
    // We can't call TimeZone.getDisplayName() because it would not use
    // the custom DateFormatSymbols of this SimpleDateFormat.
    String custom = TimeZoneNames.getDisplayName(formatData.zoneStrings, tz.getID(), daylight, style);
    if (custom != null) {
      buffer.append(custom);
      return;
    }
  }
  // We didn't find what we were looking for, so default to a numeric time zone.
  appendNumericTimeZone(buffer, count, generalTimeZone);
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

/**
 * Append a representation of the time zone of 'calendar' to 'buffer'.
 *
 * @param count the number of z or Z characters in the format string; "zzz" would be 3,
 * for example.
 * @param generalTimeZone true if we should use a display name ("PDT") if available;
 * false implies that we should use RFC 822 format ("-0800") instead. This corresponds to 'z'
 * versus 'Z' in the format string.
 */
private void appendTimeZone(StringBuffer buffer, int count, boolean generalTimeZone) {
  if (generalTimeZone) {
    TimeZone tz = calendar.getTimeZone();
    boolean daylight = (calendar.get(Calendar.DST_OFFSET) != 0);
    int style = count < 4 ? TimeZone.SHORT : TimeZone.LONG;
    if (!formatData.customZoneStrings) {
      buffer.append(tz.getDisplayName(daylight, style, formatData.locale));
      return;
    }
    // We can't call TimeZone.getDisplayName() because it would not use
    // the custom DateFormatSymbols of this SimpleDateFormat.
    String custom = TimeZoneNames.getDisplayName(formatData.zoneStrings, tz.getID(), daylight, style);
    if (custom != null) {
      buffer.append(custom);
      return;
    }
  }
  // We didn't find what we were looking for, so default to a numeric time zone.
  appendNumericTimeZone(buffer, count, generalTimeZone);
}

代码示例来源:origin: com.bugvm/bugvm-rt

/**
 * Append a representation of the time zone of 'calendar' to 'buffer'.
 *
 * @param count the number of z or Z characters in the format string; "zzz" would be 3,
 * for example.
 * @param generalTimeZone true if we should use a display name ("PDT") if available;
 * false implies that we should use RFC 822 format ("-0800") instead. This corresponds to 'z'
 * versus 'Z' in the format string.
 */
private void appendTimeZone(StringBuffer buffer, int count, boolean generalTimeZone) {
  if (generalTimeZone) {
    TimeZone tz = calendar.getTimeZone();
    boolean daylight = (calendar.get(Calendar.DST_OFFSET) != 0);
    int style = count < 4 ? TimeZone.SHORT : TimeZone.LONG;
    if (!formatData.customZoneStrings) {
      buffer.append(tz.getDisplayName(daylight, style, formatData.locale));
      return;
    }
    // We can't call TimeZone.getDisplayName() because it would not use
    // the custom DateFormatSymbols of this SimpleDateFormat.
    String custom = TimeZoneNames.getDisplayName(formatData.zoneStrings, tz.getID(), daylight, style);
    if (custom != null) {
      buffer.append(custom);
      return;
    }
  }
  // We didn't find what we were looking for, so default to a numeric time zone.
  appendNumericTimeZone(buffer, count, generalTimeZone);
}

代码示例来源:origin: FlexoVM/flexovm

/**
 * Append a representation of the time zone of 'calendar' to 'buffer'.
 *
 * @param count the number of z or Z characters in the format string; "zzz" would be 3,
 * for example.
 * @param generalTimeZone true if we should use a display name ("PDT") if available;
 * false implies that we should use RFC 822 format ("-0800") instead. This corresponds to 'z'
 * versus 'Z' in the format string.
 */
private void appendTimeZone(StringBuffer buffer, int count, boolean generalTimeZone) {
  if (generalTimeZone) {
    TimeZone tz = calendar.getTimeZone();
    boolean daylight = (calendar.get(Calendar.DST_OFFSET) != 0);
    int style = count < 4 ? TimeZone.SHORT : TimeZone.LONG;
    if (!formatData.customZoneStrings) {
      buffer.append(tz.getDisplayName(daylight, style, formatData.locale));
      return;
    }
    // We can't call TimeZone.getDisplayName() because it would not use
    // the custom DateFormatSymbols of this SimpleDateFormat.
    String custom = TimeZoneNames.getDisplayName(formatData.zoneStrings, tz.getID(), daylight, style);
    if (custom != null) {
      buffer.append(custom);
      return;
    }
  }
  // We didn't find what we were looking for, so default to a numeric time zone.
  appendNumericTimeZone(buffer, count, generalTimeZone);
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

case RFC_822_TIMEZONE_FIELD: // 'Z'
  dateFormatField = Field.TIME_ZONE;
  appendNumericTimeZone(buffer, count, false);
  break;

代码示例来源:origin: ibinti/bugvm

case RFC_822_TIMEZONE_FIELD: // 'Z'
  dateFormatField = Field.TIME_ZONE;
  appendNumericTimeZone(buffer, count, false);
  break;

代码示例来源:origin: com.bugvm/bugvm-rt

case RFC_822_TIMEZONE_FIELD: // 'Z'
  dateFormatField = Field.TIME_ZONE;
  appendNumericTimeZone(buffer, count, false);
  break;

代码示例来源:origin: MobiVM/robovm

case RFC_822_TIMEZONE_FIELD: // 'Z'
  dateFormatField = Field.TIME_ZONE;
  appendNumericTimeZone(buffer, count, false);
  break;

代码示例来源:origin: FlexoVM/flexovm

case RFC_822_TIMEZONE_FIELD: // 'Z'
  dateFormatField = Field.TIME_ZONE;
  appendNumericTimeZone(buffer, count, false);
  break;

代码示例来源:origin: com.gluonhq/robovm-rt

case RFC_822_TIMEZONE_FIELD: // 'Z'
  dateFormatField = Field.TIME_ZONE;
  appendNumericTimeZone(buffer, count, false);
  break;

相关文章

SimpleDateFormat类方法