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

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

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

SimpleDateFormat.appendNumber介绍

暂无

代码示例

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

private void appendMonth(StringBuffer buffer, int count, boolean standAlone) {
 int month = calendar.get(Calendar.MONTH);
 if (count <= 2) {
  appendNumber(buffer, count, month + 1);
  return;
 }
 String[] months;
 LocaleData ld = formatData.localeData;
 if (count == 4) {
  months = standAlone ? ld.longStandAloneMonthNames : formatData.months;
 } else if (count == 5) {
  months = standAlone ? ld.tinyStandAloneMonthNames : ld.tinyMonthNames;
 } else {
  months = standAlone ? ld.shortStandAloneMonthNames : formatData.shortMonths;
 }
 buffer.append(months[month]);
}

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

private void appendNumericTimeZone(StringBuffer buffer, int count, boolean generalTimeZone) {
  int offset = calendar.get(Calendar.ZONE_OFFSET) + calendar.get(Calendar.DST_OFFSET);
  char sign = '+';
  if (offset < 0) {
    sign = '-';
    offset = -offset;
  }
  if (generalTimeZone || count == 4) {
    buffer.append("GMT");
  }
  buffer.append(sign);
  appendNumber(buffer, 2, offset / 3600000);
  if (generalTimeZone || count >= 4) {
    buffer.append(':');
  }
  appendNumber(buffer, 2, (offset % 3600000) / 60000);
}

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

appendNumber(buffer, 2, year % 100);
  } else {
    appendNumber(buffer, count, year);
  dateFormatField = Field.HOUR_OF_DAY1;
  int hour = calendar.get(Calendar.HOUR_OF_DAY);
  appendNumber(buffer, count, hour == 0 ? 24 : hour);
  break;
case HOUR_OF_DAY0_FIELD: // 'H'
  dateFormatField = Field.MILLISECOND;
  int value = calendar.get(Calendar.MILLISECOND);
  appendNumber(buffer, count, value);
  break;
case STAND_ALONE_DAY_OF_WEEK_FIELD:
  dateFormatField = Field.HOUR1;
  hour = calendar.get(Calendar.HOUR);
  appendNumber(buffer, count, hour == 0 ? 12 : hour);
  break;
case HOUR0_FIELD: // 'K'
appendNumber(buffer, count, calendar.get(field));

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

private void appendMonth(StringBuffer buffer, int count, boolean standAlone) {
 int month = calendar.get(Calendar.MONTH);
 if (count <= 2) {
  appendNumber(buffer, count, month + 1);
  return;
 }
 String[] months;
 LocaleData ld = formatData.localeData;
 if (count == 4) {
  months = standAlone ? ld.longStandAloneMonthNames : formatData.months;
 } else if (count == 5) {
  months = standAlone ? ld.tinyStandAloneMonthNames : ld.tinyMonthNames;
 } else {
  months = standAlone ? ld.shortStandAloneMonthNames : formatData.shortMonths;
 }
 buffer.append(months[month]);
}

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

private void appendMonth(StringBuffer buffer, int count, boolean standAlone) {
 int month = calendar.get(Calendar.MONTH);
 if (count <= 2) {
  appendNumber(buffer, count, month + 1);
  return;
 }
 String[] months;
 LocaleData ld = formatData.localeData;
 if (count == 4) {
  months = standAlone ? ld.longStandAloneMonthNames : formatData.months;
 } else if (count == 5) {
  months = standAlone ? ld.tinyStandAloneMonthNames : ld.tinyMonthNames;
 } else {
  months = standAlone ? ld.shortStandAloneMonthNames : formatData.shortMonths;
 }
 buffer.append(months[month]);
}

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

private void appendNumericTimeZone(StringBuffer buffer, int count, boolean generalTimeZone) {
  int offset = calendar.get(Calendar.ZONE_OFFSET) + calendar.get(Calendar.DST_OFFSET);
  char sign = '+';
  if (offset < 0) {
    sign = '-';
    offset = -offset;
  }
  if (generalTimeZone || count == 4) {
    buffer.append("GMT");
  }
  buffer.append(sign);
  appendNumber(buffer, 2, offset / 3600000);
  if (generalTimeZone || count >= 4) {
    buffer.append(':');
  }
  appendNumber(buffer, 2, (offset % 3600000) / 60000);
}

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

private void appendMonth(StringBuffer buffer, int count, boolean standAlone) {
 int month = calendar.get(Calendar.MONTH);
 if (count <= 2) {
  appendNumber(buffer, count, month + 1);
  return;
 }
 String[] months;
 LocaleData ld = formatData.localeData;
 if (count == 4) {
  months = standAlone ? ld.longStandAloneMonthNames : formatData.months;
 } else if (count == 5) {
  months = standAlone ? ld.tinyStandAloneMonthNames : ld.tinyMonthNames;
 } else {
  months = standAlone ? ld.shortStandAloneMonthNames : formatData.shortMonths;
 }
 buffer.append(months[month]);
}

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

private void appendNumericTimeZone(StringBuffer buffer, int count, boolean generalTimeZone) {
  int offset = calendar.get(Calendar.ZONE_OFFSET) + calendar.get(Calendar.DST_OFFSET);
  char sign = '+';
  if (offset < 0) {
    sign = '-';
    offset = -offset;
  }
  if (generalTimeZone || count == 4) {
    buffer.append("GMT");
  }
  buffer.append(sign);
  appendNumber(buffer, 2, offset / 3600000);
  if (generalTimeZone || count >= 4) {
    buffer.append(':');
  }
  appendNumber(buffer, 2, (offset % 3600000) / 60000);
}

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

private void appendMonth(StringBuffer buffer, int count, boolean standAlone) {
 int month = calendar.get(Calendar.MONTH);
 if (count <= 2) {
  appendNumber(buffer, count, month + 1);
  return;
 }
 String[] months;
 LocaleData ld = formatData.localeData;
 if (count == 4) {
  months = standAlone ? ld.longStandAloneMonthNames : formatData.months;
 } else if (count == 5) {
  months = standAlone ? ld.tinyStandAloneMonthNames : ld.tinyMonthNames;
 } else {
  months = standAlone ? ld.shortStandAloneMonthNames : formatData.shortMonths;
 }
 buffer.append(months[month]);
}

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

private void appendMonth(StringBuffer buffer, int count, boolean standAlone) {
 int month = calendar.get(Calendar.MONTH);
 if (count <= 2) {
  appendNumber(buffer, count, month + 1);
  return;
 }
 String[] months;
 LocaleData ld = formatData.localeData;
 if (count == 4) {
  months = standAlone ? ld.longStandAloneMonthNames : formatData.months;
 } else if (count == 5) {
  months = standAlone ? ld.tinyStandAloneMonthNames : ld.tinyMonthNames;
 } else {
  months = standAlone ? ld.shortStandAloneMonthNames : formatData.shortMonths;
 }
 buffer.append(months[month]);
}

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

private void appendNumericTimeZone(StringBuffer buffer, int count, boolean generalTimeZone) {
  int offset = calendar.get(Calendar.ZONE_OFFSET) + calendar.get(Calendar.DST_OFFSET);
  char sign = '+';
  if (offset < 0) {
    sign = '-';
    offset = -offset;
  }
  if (generalTimeZone || count == 4) {
    buffer.append("GMT");
  }
  buffer.append(sign);
  appendNumber(buffer, 2, offset / 3600000);
  if (generalTimeZone || count >= 4) {
    buffer.append(':');
  }
  appendNumber(buffer, 2, (offset % 3600000) / 60000);
}

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

private void appendMonth(StringBuffer buffer, int count, boolean standAlone) {
 int month = calendar.get(Calendar.MONTH);
 if (count <= 2) {
  appendNumber(buffer, count, month + 1);
  return;
 }
 String[] months;
 LocaleData ld = formatData.localeData;
 if (count == 4) {
  months = standAlone ? ld.longStandAloneMonthNames : formatData.months;
 } else if (count == 5) {
  months = standAlone ? ld.tinyStandAloneMonthNames : ld.tinyMonthNames;
 } else {
  months = standAlone ? ld.shortStandAloneMonthNames : formatData.shortMonths;
 }
 buffer.append(months[month]);
}

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

private void appendNumericTimeZone(StringBuffer buffer, int count, boolean generalTimeZone) {
  int offset = calendar.get(Calendar.ZONE_OFFSET) + calendar.get(Calendar.DST_OFFSET);
  char sign = '+';
  if (offset < 0) {
    sign = '-';
    offset = -offset;
  }
  if (generalTimeZone || count == 4) {
    buffer.append("GMT");
  }
  buffer.append(sign);
  appendNumber(buffer, 2, offset / 3600000);
  if (generalTimeZone || count >= 4) {
    buffer.append(':');
  }
  appendNumber(buffer, 2, (offset % 3600000) / 60000);
}

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

private void appendNumericTimeZone(StringBuffer buffer, int count, boolean generalTimeZone) {
  int offset = calendar.get(Calendar.ZONE_OFFSET) + calendar.get(Calendar.DST_OFFSET);
  char sign = '+';
  if (offset < 0) {
    sign = '-';
    offset = -offset;
  }
  if (generalTimeZone || count == 4) {
    buffer.append("GMT");
  }
  buffer.append(sign);
  appendNumber(buffer, 2, offset / 3600000);
  if (generalTimeZone || count >= 4) {
    buffer.append(':');
  }
  appendNumber(buffer, 2, (offset % 3600000) / 60000);
}

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

private void appendNumericTimeZone(StringBuffer buffer, int count, boolean generalTimeZone) {
  int offset = calendar.get(Calendar.ZONE_OFFSET) + calendar.get(Calendar.DST_OFFSET);
  char sign = '+';
  if (offset < 0) {
    sign = '-';
    offset = -offset;
  }
  if (generalTimeZone || count == 4) {
    buffer.append("GMT");
  }
  buffer.append(sign);
  appendNumber(buffer, 2, offset / 3600000);
  if (generalTimeZone || count >= 4) {
    buffer.append(':');
  }
  appendNumber(buffer, 2, (offset % 3600000) / 60000);
}

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

appendNumber(buffer, 2, year % 100);
  } else {
    appendNumber(buffer, count, year);
  dateFormatField = Field.HOUR_OF_DAY1;
  int hour = calendar.get(Calendar.HOUR_OF_DAY);
  appendNumber(buffer, count, hour == 0 ? 24 : hour);
  break;
case HOUR_OF_DAY0_FIELD: // 'H'
  dateFormatField = Field.MILLISECOND;
  int value = calendar.get(Calendar.MILLISECOND);
  appendNumber(buffer, count, value);
  break;
case STAND_ALONE_DAY_OF_WEEK_FIELD:
  dateFormatField = Field.HOUR1;
  hour = calendar.get(Calendar.HOUR);
  appendNumber(buffer, count, hour == 0 ? 12 : hour);
  break;
case HOUR0_FIELD: // 'K'
appendNumber(buffer, count, calendar.get(field));

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

appendNumber(buffer, 2, year % 100);
  } else {
    appendNumber(buffer, count, year);
  dateFormatField = Field.HOUR_OF_DAY1;
  int hour = calendar.get(Calendar.HOUR_OF_DAY);
  appendNumber(buffer, count, hour == 0 ? 24 : hour);
  break;
case HOUR_OF_DAY0_FIELD: // 'H'
  dateFormatField = Field.MILLISECOND;
  int value = calendar.get(Calendar.MILLISECOND);
  appendNumber(buffer, count, value);
  break;
case STAND_ALONE_DAY_OF_WEEK_FIELD:
  dateFormatField = Field.HOUR1;
  hour = calendar.get(Calendar.HOUR);
  appendNumber(buffer, count, hour == 0 ? 12 : hour);
  break;
case HOUR0_FIELD: // 'K'
appendNumber(buffer, count, calendar.get(field));

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

appendNumber(buffer, 2, year % 100);
  } else {
    appendNumber(buffer, count, year);
  dateFormatField = Field.HOUR_OF_DAY1;
  int hour = calendar.get(Calendar.HOUR_OF_DAY);
  appendNumber(buffer, count, hour == 0 ? 24 : hour);
  break;
case HOUR_OF_DAY0_FIELD: // 'H'
  dateFormatField = Field.MILLISECOND;
  int value = calendar.get(Calendar.MILLISECOND);
  appendNumber(buffer, count, value);
  break;
case STAND_ALONE_DAY_OF_WEEK_FIELD:
  dateFormatField = Field.HOUR1;
  hour = calendar.get(Calendar.HOUR);
  appendNumber(buffer, count, hour == 0 ? 12 : hour);
  break;
case HOUR0_FIELD: // 'K'
appendNumber(buffer, count, calendar.get(field));

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

appendNumber(buffer, 2, year % 100);
  } else {
    appendNumber(buffer, count, year);
  dateFormatField = Field.HOUR_OF_DAY1;
  int hour = calendar.get(Calendar.HOUR_OF_DAY);
  appendNumber(buffer, count, hour == 0 ? 24 : hour);
  break;
case HOUR_OF_DAY0_FIELD: // 'H'
  dateFormatField = Field.MILLISECOND;
  int value = calendar.get(Calendar.MILLISECOND);
  appendNumber(buffer, count, value);
  break;
case STAND_ALONE_DAY_OF_WEEK_FIELD:
  dateFormatField = Field.HOUR1;
  hour = calendar.get(Calendar.HOUR);
  appendNumber(buffer, count, hour == 0 ? 12 : hour);
  break;
case HOUR0_FIELD: // 'K'
appendNumber(buffer, count, calendar.get(field));

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

appendNumber(buffer, 2, year % 100);
  } else {
    appendNumber(buffer, count, year);
  dateFormatField = Field.HOUR_OF_DAY1;
  int hour = calendar.get(Calendar.HOUR_OF_DAY);
  appendNumber(buffer, count, hour == 0 ? 24 : hour);
  break;
case HOUR_OF_DAY0_FIELD: // 'H'
  dateFormatField = Field.MILLISECOND;
  int value = calendar.get(Calendar.MILLISECOND);
  appendNumber(buffer, count, value);
  break;
case STAND_ALONE_DAY_OF_WEEK_FIELD:
  dateFormatField = Field.HOUR1;
  hour = calendar.get(Calendar.HOUR);
  appendNumber(buffer, count, hour == 0 ? 12 : hour);
  break;
case HOUR0_FIELD: // 'K'
appendNumber(buffer, count, calendar.get(field));

相关文章

SimpleDateFormat类方法