public class WarekiFormat extends DateFormat
SimpleDateFormat
を参照してください。
※和暦の解析は、現在のところできません。
時刻フォーマット構文:時刻フォーマットを指定するには、時刻パターン文字列を使用します。 このパターンでは、すべての ASCII 文字がパターン文字として使用されます。 SimpleDateFormatで定義されている文字列に加えて以下の文字列が使用できます。
年号 意味 表示 例 ------ ------- ------------ ------- g 元号 (テキスト) 平成 Y 年(和暦) (数値) 13
SimpleDateFormat
,
DateFormat
,
直列化された形式DateFormat.Field
AM_PM_FIELD, calendar, DATE_FIELD, DAY_OF_WEEK_FIELD, DAY_OF_WEEK_IN_MONTH_FIELD, DAY_OF_YEAR_FIELD, DEFAULT, ERA_FIELD, FULL, HOUR_OF_DAY0_FIELD, HOUR_OF_DAY1_FIELD, HOUR0_FIELD, HOUR1_FIELD, LONG, MEDIUM, MILLISECOND_FIELD, MINUTE_FIELD, MONTH_FIELD, numberFormat, SECOND_FIELD, SHORT, TIMEZONE_FIELD, WEEK_OF_MONTH_FIELD, WEEK_OF_YEAR_FIELD, YEAR_FIELD
コンストラクタと説明 |
---|
WarekiFormat()
デフォルトローケルのデフォルトパターンを使って初期化します。
|
WarekiFormat(String fmt)
デフォルトロケールの指定されたパターンを使って初期化します。
|
WarekiFormat(String fmt,
Locale loc)
指定されたロケールの指定されたパターンを使って初期化します。
|
WarekiFormat(String fmt,
Locale loc,
TimeZone tz)
指定されたロケールの指定されたパターンを使って初期化します。
|
修飾子とタイプ | メソッドと説明 |
---|---|
void |
applyPattern(String s)
指定されたパターン文字列を、この日付フォーマットに適用します
|
StringBuffer |
format(Date date,
StringBuffer toAppendTo,
FieldPosition pos)
Date を日付/時刻文字列にフォーマットします。
|
AttributedCharacterIterator |
formatToCharacterIterator(Object obj)
Objectをフォーマットし、AttributedCharacterliteratorを生成します。
|
static void |
main(String[] args) |
Date |
parse(String text,
ParsePosition pos)
日付/時刻文字列を解析します。
|
Object |
parseObject(String source,
ParsePosition pos) |
String |
patternCheck(String text,
StringBuffer buffer,
ParsePosition pos,
boolean[] flags) |
String |
toPattern()
フォーマットパターンを取得する
|
clone, equals, format, format, getAvailableLocales, getCalendar, getDateInstance, getDateInstance, getDateInstance, getDateTimeInstance, getDateTimeInstance, getDateTimeInstance, getInstance, getNumberFormat, getTimeInstance, getTimeInstance, getTimeInstance, getTimeZone, hashCode, isLenient, parse, setCalendar, setLenient, setNumberFormat, setTimeZone
format, parseObject
public WarekiFormat(String fmt, Locale loc, TimeZone tz)
fmt
- フォーマット文字列public WarekiFormat(String fmt, Locale loc)
fmt
- フォーマット文字列public WarekiFormat(String fmt)
fmt
- フォーマット文字列public WarekiFormat()
public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition pos)
format
クラス内 DateFormat
date
- 日付/時刻文字列にフォーマットする DatetoAppendTo
- 返される時刻文字列のための文字列バッファpos
- 返された文字列内のフィールド位置を把握する。
入力時は、必要であれば位置合わせフィールド。
出力時は、位置合わせフィールドのオフセット。public Date parse(String text, ParsePosition pos)
parse
クラス内 DateFormat
text
- 解析する日付/時刻文字列pos
- 入力時は、解析を開始する位置。
出力時は、解析が終了した位置、
または解析が失敗した場合には開始位置public String patternCheck(String text, StringBuffer buffer, ParsePosition pos, boolean[] flags)
public String toPattern()
public void applyPattern(String s)
s
- この日付フォーマットのための新しい日付と時刻パターンpublic AttributedCharacterIterator formatToCharacterIterator(Object obj)
formatToCharacterIterator
クラス内 Format
obj
- フォーマットするオブジェクトpublic Object parseObject(String source, ParsePosition pos)
parseObject
クラス内 DateFormat
public static void main(String[] args)
Copyright © 2021 S.D.S Co.,Ltd.. All rights reserved.