org.apache.commons.lang.time
クラス DateFormatUtils

java.lang.Object
  拡張org.apache.commons.lang.time.DateFormatUtils

public class DateFormatUtils
extends Object

日付と時間のフォーマットを行うユーティリティと定数です。

Date and time formatting utilites and constants.

フォーマットは FastDateFormat クラスを使用して行われます。

Formatting is performed using the {@link org.apache.commons.lang.time.FastDateFormat} class.

導入されたバージョン:
2.0
バージョン:
$Id: DateFormatUtils.java,v 1.1.1.1 2004/02/13 10:02:05 hioki Exp $
作成者:
Apache Ant - DateUtils, Stephane Bailliez, Stefan Bodewig, Stephen Colebourne, Gary Gregory
翻訳者:
日置 聡
翻訳状況:
初稿(校正者募集中)
翻訳更新日:
2003/09/21

フィールドの概要
static FastDateFormat ISO_DATE_FORMAT
          タイムゾーンを含まない ISO8601 の日付のフォーマッターです。
static FastDateFormat ISO_DATE_TIME_ZONE_FORMAT
          タイムゾーンを含む ISO8601 に似た日付のフォーマッターです。
static FastDateFormat ISO_DATETIME_FORMAT
          タイムゾーンを含まない ISO8601 の日付-時間のフォーマッターです。
static FastDateFormat ISO_DATETIME_TIME_ZONE_FORMAT
          タイムゾーンを含む ISO8601 の日付-時間のフォーマッターです。
static FastDateFormat ISO_TIME_FORMAT
          タイムゾーンを含まない ISO8601 の時間のフォーマッターです。
static FastDateFormat ISO_TIME_NO_T_FORMAT
          タイムゾーンを含まない ISO8601 に似た時間のフォーマッターです。
static FastDateFormat ISO_TIME_NO_T_TIME_ZONE_FORMAT
          タイムゾーンを含む ISO8601 に似た時間のフォーマッターです。
static FastDateFormat ISO_TIME_TIME_ZONE_FORMAT
          タイムゾーンを含む ISO8601 の時間のフォーマッターです。
static FastDateFormat SMTP_DATETIME_FORMAT
          SMTP(等で使用される)日付のヘッダの様式です。
 
コンストラクタの概要
DateFormatUtils()
          DateFormatUtils のインスタンスは一般的なプログラムからは生成すべきではありません。
 
メソッドの概要
static String format(Date date, String pattern)
          指定されたパターンで日付/時間をフォーマットします。
static String format(Date date, String pattern, Locale locale)
          指定されたパターンと指定されたロケールを用いて日付/時間をフォーマットします。
static String format(Date date, String pattern, TimeZone timeZone)
          指定されたパターンと指定されたタイムゾーンを用いて日付/時間をフォーマットします。
static String format(Date date, String pattern, TimeZone timeZone, Locale locale)
          指定されたパターン、タイムゾーン、ロケールを用いて日付/時間をフォーマットします。
static String format(long millis, String pattern)
          指定されたパターンで日付/時間をフォーマットします。
static String format(long millis, String pattern, Locale locale)
          指定されたパターンと指定されたロケールを用いて日付/時間をフォーマットします。
static String format(long millis, String pattern, TimeZone timeZone)
          指定されたパターンと指定されたタイムゾーンを用いて日付/時間をフォーマットします。
static String format(long millis, String pattern, TimeZone timeZone, Locale locale)
          指定されたパターン、タイムゾーン、ロケールを用いて日付/時間をフォーマットします。
static String formatUTC(Date date, String pattern)
          指定されたパターンと UTC タイムゾーンを用いて日付/時間をフォーマットします。
static String formatUTC(Date date, String pattern, Locale locale)
          指定されたパターンと UTC タイムゾーンを用いて日付/時間をフォーマットします。
static String formatUTC(long millis, String pattern)
          指定されたパターンと UTC タイムゾーンを用いて日付/時間をフォーマットします。
static String formatUTC(long millis, String pattern, Locale locale)
          指定されたパターンと UTC タイムゾーンを用いて日付/時間をフォーマットします。
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

フィールドの詳細

ISO_DATETIME_FORMAT

public static final FastDateFormat ISO_DATETIME_FORMAT
タイムゾーンを含まない ISO8601 の日付-時間のフォーマッターです。 使用されるフォーマットは yyyy-MM-dd'T'HH:mm:ss です。
ISO8601 formatter for date-time witout time zone. The format used is yyyy-MM-dd'T'HH:mm:ss.


ISO_DATETIME_TIME_ZONE_FORMAT

public static final FastDateFormat ISO_DATETIME_TIME_ZONE_FORMAT
タイムゾーンを含む ISO8601 の日付-時間のフォーマッターです。 使用されるフォーマットは yyyy-MM-dd'T'HH:mm:ssZZ です。
ISO8601 formatter for date-time with time zone. The format used is yyyy-MM-dd'T'HH:mm:ssZZ.


ISO_DATE_FORMAT

public static final FastDateFormat ISO_DATE_FORMAT
タイムゾーンを含まない ISO8601 の日付のフォーマッターです。 使用されるフォーマットは yyyy-MM-dd です。
ISO8601 formatter for date without time zone. The format used is yyyy-MM-dd.


ISO_DATE_TIME_ZONE_FORMAT

public static final FastDateFormat ISO_DATE_TIME_ZONE_FORMAT
タイムゾーンを含む ISO8601 に似た日付のフォーマッターです。 使用されるフォーマットは yyyy-MM-ddZZ です。 正式な ISO8601 の仕様では時間を省略した場合のタイムゾーンの指定を許可しないためこのパターンは仕様に準じていません。
ISO8601-like formatter for date with time zone. The format used is yyyy-MM-ddZZ. This pattern does not comply with the formal ISO8601 specification as the standard does not allow a time zone without a time.


ISO_TIME_FORMAT

public static final FastDateFormat ISO_TIME_FORMAT
タイムゾーンを含まない ISO8601 の時間のフォーマッターです。 使用されるフォーマットは 'T'HH:mm:ss です。
ISO8601 formatter for time without time zone. The format used is 'T'HH:mm:ss.


ISO_TIME_TIME_ZONE_FORMAT

public static final FastDateFormat ISO_TIME_TIME_ZONE_FORMAT
タイムゾーンを含む ISO8601 の時間のフォーマッターです。 使用されるフォーマットは 'T'HH:mm:ssZZ です。
ISO8601 formatter for time with time zone. The format used is 'T'HH:mm:ssZZ.


ISO_TIME_NO_T_FORMAT

public static final FastDateFormat ISO_TIME_NO_T_FORMAT
タイムゾーンを含まない ISO8601 に似た時間のフォーマッターです。 使用されるフォーマットは HH:mm:ss です。 正式な ISO8601 の仕様では時間には 'T' プレフィックスを要求するため、このパターンは仕様に準じていません。
ISO8601-like formatter for time without time zone. The format used is HH:mm:ss. This pattern does not comply with the formal ISO8601 specification as the standard requires the 'T' prefix for times.


ISO_TIME_NO_T_TIME_ZONE_FORMAT

public static final FastDateFormat ISO_TIME_NO_T_TIME_ZONE_FORMAT
タイムゾーンを含む ISO8601 に似た時間のフォーマッターです。 使用されるフォーマットは HH:mm:ssZZ です。 正式な ISO8601 の仕様では時間には 'T' プレフィックスを要求するため、このパターンは仕様に準じていません。
ISO8601-like formatter for time with time zone. The format used is HH:mm:ssZZ. This pattern does not comply with the formal ISO8601 specification as the standard requires the 'T' prefix for times.


SMTP_DATETIME_FORMAT

public static final FastDateFormat SMTP_DATETIME_FORMAT
SMTP(等で使用される)日付のヘッダの様式です。 US ロケールでは EEE, dd MMM yyyy HH:mm:ss Z のフォーマットが使用されます。
SMTP (and probably other) date headers. The format used is EEE, dd MMM yyyy HH:mm:ss Z in US locale.

コンストラクタの詳細

DateFormatUtils

public DateFormatUtils()

DateFormatUtils のインスタンスは一般的なプログラムからは生成すべきではありません。

DateFormatUtils instances should NOT be constructed in standard programming.

このコンストラクタは、処理のために JavaBean インスタンスを必要とするツールのために public になっています。

This constructor is public to permit tools that require a JavaBean instance to operate.

メソッドの詳細

formatUTC

public static String formatUTC(long millis,
                               String pattern)

指定されたパターンと UTC タイムゾーンを用いて日付/時間をフォーマットします。

Format a date/time into a specific pattern using the UTC time zone.

パラメータ:
millis - ミリセカンドで表現されたフォーマットの対象となる日付
the date to format expressed in milliseconds
pattern - 日付をフォーマットする際に使用されるパターン
the pattern to use to format the date
戻り値:
フォーマットされた日付
the formatted date

formatUTC

public static String formatUTC(Date date,
                               String pattern)

指定されたパターンと UTC タイムゾーンを用いて日付/時間をフォーマットします。

Format a date/time into a specific pattern using the UTC time zone.

パラメータ:
date - フォーマットの対象となる日付
the date to format
pattern - 日付をフォーマットする際に使用されるパターン
the pattern to use to format the date
戻り値:
フォーマットされた日付
the formatted date

formatUTC

public static String formatUTC(long millis,
                               String pattern,
                               Locale locale)

指定されたパターンと UTC タイムゾーンを用いて日付/時間をフォーマットします。

Format a date/time into a specific pattern using the UTC time zone.

パラメータ:
millis - ミリセカンドで表現されたフォーマットの対象となる日付
the date to format expressed in milliseconds
pattern - 日付をフォーマットする際に使用されるパターン
the pattern to use to format the date
locale - 使用するロケール、 null を許容します。
the locale to use, may be null
戻り値:
フォーマットされた日付
the formatted date

formatUTC

public static String formatUTC(Date date,
                               String pattern,
                               Locale locale)

指定されたパターンと UTC タイムゾーンを用いて日付/時間をフォーマットします。

Format a date/time into a specific pattern using the UTC time zone.

パラメータ:
date - フォーマットの対象となる日付
the date to format
pattern - 日付をフォーマットする際に使用されるパターン
the pattern to use to format the date
locale - 使用するロケール、 null を許容します。
the locale to use, may be null
戻り値:
フォーマットされた日付
the formatted date

format

public static String format(long millis,
                            String pattern)

指定されたパターンで日付/時間をフォーマットします。

Format a date/time into a specific pattern.

パラメータ:
millis - ミリセカンドで表現されたフォーマットの対象となる日付
the date to format expressed in milliseconds
pattern - 日付をフォーマットする際に使用されるパターン
the pattern to use to format the date
戻り値:
フォーマットされた日付
the formatted date

format

public static String format(Date date,
                            String pattern)

指定されたパターンで日付/時間をフォーマットします。

Format a date/time into a specific pattern.

パラメータ:
date - フォーマットの対象となる日付
the date to format
pattern - 日付をフォーマットする際に使用されるパターン
the pattern to use to format the date
戻り値:
フォーマットされた日付
the formatted date

format

public static String format(long millis,
                            String pattern,
                            TimeZone timeZone)

指定されたパターンと指定されたタイムゾーンを用いて日付/時間をフォーマットします。

Format a date/time into a specific pattern in a time zone.

パラメータ:
millis - ミリセカンドで表現されたフォーマットの対象となる日付
the date to format expressed in milliseconds
pattern - 日付をフォーマットする際に使用されるパターン
the pattern to use to format the date
timeZone - 使用するタイムゾーン、 null を許容します。
the time zone to use, may be null
戻り値:
フォーマットされた日付
the formatted date

format

public static String format(Date date,
                            String pattern,
                            TimeZone timeZone)

指定されたパターンと指定されたタイムゾーンを用いて日付/時間をフォーマットします。

Format a date/time into a specific pattern in a time zone.

パラメータ:
date - フォーマットの対象となる日付
the date to format
pattern - 日付をフォーマットする際に使用されるパターン
the pattern to use to format the date
timeZone - 使用するタイムゾーン、 null を許容します。
the time zone to use, may be null
戻り値:
フォーマットされた日付
the formatted date

format

public static String format(long millis,
                            String pattern,
                            Locale locale)

指定されたパターンと指定されたロケールを用いて日付/時間をフォーマットします。

Format a date/time into a specific pattern in a locale.

パラメータ:
millis - ミリセカンドで表現されたフォーマットの対象となる日付
the date to format expressed in milliseconds
pattern - 日付をフォーマットする際に使用されるパターン
the pattern to use to format the date
locale - 使用するロケール、 null を許容します。
the locale to use, may be null
戻り値:
フォーマットされた日付
the formatted date

format

public static String format(Date date,
                            String pattern,
                            Locale locale)

指定されたパターンと指定されたロケールを用いて日付/時間をフォーマットします。

Format a date/time into a specific pattern in a locale.

パラメータ:
date - フォーマットの対象となる日付
the date to format
pattern - 日付をフォーマットする際に使用されるパターン
the pattern to use to format the date
locale - 使用するロケール、 null を許容します。
the locale to use, may be null
戻り値:
フォーマットされた日付
the formatted date

format

public static String format(long millis,
                            String pattern,
                            TimeZone timeZone,
                            Locale locale)

指定されたパターン、タイムゾーン、ロケールを用いて日付/時間をフォーマットします。

Format a date/time into a specific pattern in a time zone and locale.

パラメータ:
millis - ミリセカンドで表現されたフォーマットの対象となる日付
the date to format expressed in milliseconds
pattern - 日付をフォーマットする際に使用されるパターン
the pattern to use to format the date
timeZone - 使用するタイムゾーン、 null を許容します。
the time zone to use, may be null
locale - 使用するロケール、 null を許容します。
the locale to use, may be null
戻り値:
フォーマットされた日付
the formatted date

format

public static String format(Date date,
                            String pattern,
                            TimeZone timeZone,
                            Locale locale)

指定されたパターン、タイムゾーン、ロケールを用いて日付/時間をフォーマットします。

Format a date/time into a specific pattern in a time zone and locale.

パラメータ:
date - フォーマットの対象となる日付
the date to format
pattern - 日付をフォーマットする際に使用されるパターン
the pattern to use to format the date
timeZone - 使用するタイムゾーン、 null を許容します。
the time zone to use, may be null
locale - 使用するロケール、 null を許容します。
the locale to use, may be null
戻り値:
フォーマットされた日付
the formatted date


このドキュメントは、Ja-Jakartaにより訳されました。 コメントがある場合は report@jajakarta.orgまでお願いします。
Translated into Japanese by jajakarta.org. The original page is here.
Copyright (c) 2002-2003 - Apache Software Foundation