Skip navigation links
EDB/Java
jp.ac.tokushima_u.edb

Class EdbDate

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class and Description
      static class  EdbDate.FMT 
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      protected int date 
      static int DATE_MAX 
      static int DATE_MIN 
    • Constructor Summary

      Constructors 
      Constructor and Description
      EdbDate(int d)
      指定された日付で,新しいインスタンスを初期化します.
      EdbDate(int y, int m, int d)
      指定された年月日で,新しいインスタンスを初期化します.
      EdbDate(String s)
      指定された日付で,新しいインスタンスを初期化します.
      EdbDate(UDate udate)
      指定された年月日で,新しいインスタンスを初期化します.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      int compareTo(EdbDate d)
      int compareTo(int d)
      このオブジェクトが表す日付と指定された日付を比較します.
      int day()
      Retrieve day of this object.
      static int day(int d)
      指定された日付 d から日を取得します.
      EdbDate duplicate()
      このオブジェクトの複製を作成します.
      boolean equals(EdbDate d)
      このオブジェクトが表す日付と等しいかどうか判定します.
      boolean equals(int d)
      このオブジェクトが表す日付と等しいかどうか判定します.
      int getCivilYear()
      Retrieve civil year of this object.
      static int getCivilYear(int d)
      Retrieve year of specified date.
      int getFiscalYear()
      Retrieve fiscal year of this object.
      static int getFiscalYear(int d)
      Retrieve fiscal year.
      int hashCode()
      このオブジェクトのハッシュコードを取得します.
      static int HMS(int h, int m, int s)
      指定された時分秒を表す時刻を取得します.
      static int hour(int t)
      時刻から時を取得します.
      int intValue()
      このオブジェクトが表す日付を int 型で取得します.
      static int intValue(String s)
      数字で表された日付を int 型に変換します.
      boolean isFuture(int f, int t)
      このオブジェクトが表す日付より指定された期間が未来にあるかどうか判定します.
      static boolean isFuture(int d, int f, int t)
      指定された日付 d より指定された期間が未来にあるかどうか判定します.
      boolean isInner(EdbDate2 p)
      このオブジェクトが表す日付が指定された期間の内にあるかどうか判定します.
      boolean isInner(EdbDate f, EdbDate t)
      このオブジェクトが表す日付が指定された期間の内にあるかどうか判定します.
      boolean isInner(int f, int t)
      このオブジェクトが表す日付が指定された期間の内にあるかどうか判定します.
      static boolean isInner(int d, int f, int t)
      指定された日付 d が指定された期間の内にあるかどうか判定します.
      static boolean isOverlap(EdbDate f1, EdbDate t1, EdbDate f2, EdbDate t2)
      指定された期間が重なる部分をもつかどうかを判定します.
      static boolean isOverlap(int f1, int t1, int f2, int t2)
      指定された期間が重なる部分をもつかどうかを判定します.
      boolean isPast(int f, int t)
      このオブジェクトが表す日付より指定された期間が過去にあるかどうか判定します.
      static boolean isPast(int d, int f, int t)
      指定された日付 d より指定された期間が過去にあるかどうか判定します.
      boolean isUsable()
      このオブジェクトが表す日付が有効かどうかを判定します.
      static boolean isUsable(int date)
      指定された日付 date が有効かどうかを判定します.
      static int minute(int t)
      時刻から分を取得します.
      int month()
      Retrieve month of this object.
      static int month(int d)
      指定された日付 d から月を取得します.
      static int round(int date)
      日付の範囲の範囲外にある日付を,その範囲の最も近い値に丸めます.
      static int second(int t)
      時刻から秒を取得します.
      String toADString()
      このオブジェクトが表す日付を西暦の文字列に変換します.
      String toADYMString()
      このオブジェクトが表す日付を西暦の文字列に変換します.
      static EdbDate today()
      現在の日付を取得します.
      CharSequence toISO8601()
      ISO8601準拠の日付フォーマットに変換する.
      static CharSequence toISO8601(EdbDate date)
      ISO8601準拠の日付フォーマットに変換する.
      String toJEraString()
      このオブジェクトが表す日付を和暦の文字列に変換します.
      String toJEraYearString()
      このオブジェクトが表す日付を和暦の年の文字列に変換します.
      String toJEraYMString()
      このオブジェクトが表す日付を和暦の文字列に変換します.
      LocalDateTime toLocalDateTime()
      Convert to LocalDateTime.
      String toString()
      このオブジェクトが表す日付を数字の文字列に変換します.
      static String toString(int date)
      指定された日付 date を数字の文字列に変換します.
      String toText(EdbDate.FMT fmt)
      このオブジェクトが表す日付を指定されたフォーマットの文字列に変換します.
      UDate toUDate()
      Convert to Udate.
      int year()
      Retrieve year.
      static int year(int d)
      Retrieve year of specified date.
      static int YMD(int y, int m, int d)
      指定された年月日を表す日付を取得します.
    • Constructor Detail

      • EdbDate

        public EdbDate(int d)
        指定された日付で,新しいインスタンスを初期化します.
        Parameters:
        d - 日付
      • EdbDate

        public EdbDate(String s)
        指定された日付で,新しいインスタンスを初期化します.
        Parameters:
        s - 日付
      • EdbDate

        public EdbDate(int y,
                       int m,
                       int d)
        指定された年月日で,新しいインスタンスを初期化します.
        Parameters:
        y - 年
        m - 月
        d - 日
      • EdbDate

        public EdbDate(UDate udate)
        指定された年月日で,新しいインスタンスを初期化します.
        Parameters:
        udate - UDate
    • Method Detail

      • duplicate

        public EdbDate duplicate()
        このオブジェクトの複製を作成します.
        Returns:
        複製されたオブジェクトを返します.
      • intValue

        public static int intValue(String s)
        数字で表された日付を int 型に変換します.
        Parameters:
        s - 日付
        Returns:
        変換に成功した場合は,int 型でその日付を返します.失敗した場合は,0 を返します.
      • intValue

        public int intValue()
        このオブジェクトが表す日付を int 型で取得します.
        Returns:
        日付を int 型で返します.
      • toString

        public static String toString(int date)
        指定された日付 date を数字の文字列に変換します.

        変換される形式は次のようになります.

         yyyymmdd
        
         yyyy ... 年を表す 4 文字の数字
         mm   ... 月を表す 2 文字の数字
         dd   ... 日を表す 2 文字の数字
         
        Parameters:
        date - 日付
        Returns:
        数字の文字列を返します.
      • toString

        public String toString()
        このオブジェクトが表す日付を数字の文字列に変換します.

        変換される形式は次のようになります.

         yyyymmdd
        
         yyyy ... 年を表す 4 文字の数字
         mm   ... 月を表す 2 文字の数字
         dd   ... 日を表す 2 文字の数字
         
        Overrides:
        toString in class Object
        Returns:
        数字の文字列を返します.
      • toISO8601

        public CharSequence toISO8601()
        ISO8601準拠の日付フォーマットに変換する.
        Returns:
        ISO8601表現.
      • toISO8601

        public static CharSequence toISO8601(EdbDate date)
        ISO8601準拠の日付フォーマットに変換する.
        Parameters:
        date - date.
        Returns:
        ISO8601表現.
      • toADString

        public String toADString()
        このオブジェクトが表す日付を西暦の文字列に変換します.

        変換される形式は次のようになります.

         西暦y年m月d日
        
         y ... 年
         m ... 月
         d ... 日
         
        また,変換の際に特定の月・日は,次の文字に置き換わります.
         0月  ... 初月
         99月 ... 末月
         0日  ... 初日
         99日 ... 末日
         
        Returns:
        変換に成功した場合は,西暦の文字列を返します.失敗した場合は,空の文字列("")を返します.
      • toADYMString

        public String toADYMString()
        このオブジェクトが表す日付を西暦の文字列に変換します.

        変換される形式は次のようになります.

         西暦y年m月
        
         y ... 年
         m ... 月
         
        また,変換の際に特定の月・日は,次の文字に置き換わります.
         0月  ... 初月
         99月 ... 末月
         
        Returns:
        変換に成功した場合は,西暦の文字列を返します.失敗した場合は,空の文字列("")を返します.
      • toJEraString

        public String toJEraString()
        このオブジェクトが表す日付を和暦の文字列に変換します.

        変換される形式は次のようになります.

         e年m月d日
        
         e ... 年号と年
         m ... 月
         d ... 日
         
        また,変換の際に特定の年・月・日は,次の文字に置き換わります.
         1年  ... 元日
         0月  ... 初月
         99月 ... 末月
         0日  ... 初日
         99日 ... 末日
         
        日付の年が明治以前の場合は,西暦に変換されます.
        Returns:
        変換に成功した場合は,和暦の文字列を返します.失敗した場合は,空の文字列("")を返します.
      • toJEraYMString

        public String toJEraYMString()
        このオブジェクトが表す日付を和暦の文字列に変換します.

        変換される形式は次のようになります.

         e年m月
        
         e ... 年号と年
         m ... 月
         
        また,変換の際に特定の年・月・日は,次の文字に置き換わります.
         1年  ... 元日
         0月  ... 初月
         99月 ... 末月
         
        日付の年が明治以前の場合は,西暦に変換されます.
        Returns:
        変換に成功した場合は,和暦の文字列を返します.失敗した場合は,空の文字列("")を返します.
      • toJEraYearString

        public String toJEraYearString()
        このオブジェクトが表す日付を和暦の年の文字列に変換します.

        変換される形式は次のようになります.

         e年
        
         e ... 年号と年
         
        また,変換の際に特定の年は,次の文字に置き換わります.
         1年  ... 元年
         
        日付の年が明治以前の場合は,西暦に変換されます.
        Returns:
        変換に成功した場合は,和暦の年の文字列を返します.失敗した場合は,空の文字列("")を返します.
      • isUsable

        public static final boolean isUsable(int date)
        指定された日付 date が有効かどうかを判定します.

        このメソッドは,日付が有効な範囲の値( DATE_MIN より上,DATE_MAX より下の値)かどうかを調べます.

        Parameters:
        date - 日付
        Returns:
        有効な場合は true,その他 false を返します.
        See Also:
        DATE_MIN, DATE_MAX
      • isUsable

        public boolean isUsable()
        このオブジェクトが表す日付が有効かどうかを判定します.

        このメソッドは,日付が有効な範囲の値( DATE_MIN より上,DATE_MAX より下の値)かどうかを調べます.

        Returns:
        有効な場合は true,その他 false を返します.
        See Also:
        DATE_MIN, DATE_MAX
      • round

        public static final int round(int date)
        日付の範囲の範囲外にある日付を,その範囲の最も近い値に丸めます.

        このメソッドは,日付が DATE_MIN より小さい値の場合は DATE_MIN に, DATE_MAX より大きい値の場合は DATE_MAX に丸めます.

        Parameters:
        date - 日付
        Returns:
        丸められた日付を返します.
        See Also:
        DATE_MIN, DATE_MAX
      • year

        public static final int year(int d)
        Retrieve year of specified date.
        Parameters:
        d - date
        Returns:
        year (civil year) of d
      • year

        public final int year()
        Retrieve year.
        Returns:
        year (civil year) of date.
      • getCivilYear

        public static final int getCivilYear(int d)
        Retrieve year of specified date.
        Parameters:
        d - date
        Returns:
        year (civil year) of d.
      • getCivilYear

        public final int getCivilYear()
        Retrieve civil year of this object.
        Returns:
        civil year of date.
      • getFiscalYear

        public static final int getFiscalYear(int d)
        Retrieve fiscal year.
        Parameters:
        d - date
        Returns:
        fiscal year of date.
      • getFiscalYear

        public final int getFiscalYear()
        Retrieve fiscal year of this object.
        Returns:
        fiscal year of date.
      • month

        public static final int month(int d)
        指定された日付 d から月を取得します.
        Parameters:
        d - 日付
        Returns:
        月を返します.
      • month

        public final int month()
        Retrieve month of this object.
        Returns:
        month of date.
      • day

        public static final int day(int d)
        指定された日付 d から日を取得します.
        Parameters:
        d - 日付
        Returns:
        日を返します.
      • day

        public final int day()
        Retrieve day of this object.
        Returns:
        day of date.
      • YMD

        public static final int YMD(int y,
                                    int m,
                                    int d)
        指定された年月日を表す日付を取得します.
        Parameters:
        y - year
        m - month
        d - day
        Returns:
        date from y, m, d.
      • today

        public static EdbDate today()
        現在の日付を取得します.
        Returns:
        today
      • hour

        public static final int hour(int t)
        時刻から時を取得します.
        Parameters:
        t - 時刻
        Returns:
        時を返します.
      • minute

        public static final int minute(int t)
        時刻から分を取得します.
        Parameters:
        t - 時刻
        Returns:
        分を返します.
      • second

        public static final int second(int t)
        時刻から秒を取得します.
        Parameters:
        t - 時刻
        Returns:
        秒を返します.
      • HMS

        public static final int HMS(int h,
                                    int m,
                                    int s)
        指定された時分秒を表す時刻を取得します.
        Parameters:
        h - 時
        m - 分
        s - 秒
        Returns:
        時刻を返します.
      • isInner

        public static final boolean isInner(int d,
                                            int f,
                                            int t)
        指定された日付 d が指定された期間の内にあるかどうか判定します.
        Parameters:
        d - 日付
        f - 期間(始まり)
        t - 期間(終わり)
        Returns:
        期間の内にある場合は true,その他 false を返します.
      • isInner

        public final boolean isInner(int f,
                                     int t)
        このオブジェクトが表す日付が指定された期間の内にあるかどうか判定します.
        Parameters:
        f - 期間(始まり)
        t - 期間(終わり)
        Returns:
        期間の内にある場合は true,その他 false を返します.
      • isInner

        public final boolean isInner(EdbDate f,
                                     EdbDate t)
        このオブジェクトが表す日付が指定された期間の内にあるかどうか判定します.
        Parameters:
        f - 期間(始まり)
        t - 期間(終わり)
        Returns:
        期間の内にある場合は true,その他 false を返します.
      • isInner

        public final boolean isInner(EdbDate2 p)
        このオブジェクトが表す日付が指定された期間の内にあるかどうか判定します.
        Parameters:
        p - 期間
        Returns:
        期間の内にある場合は true,その他 false を返します.
      • isFuture

        public static final boolean isFuture(int d,
                                             int f,
                                             int t)
        指定された日付 d より指定された期間が未来にあるかどうか判定します.
        Parameters:
        d - 日付
        f - 期間(始まり)
        t - 期間(終わり)
        Returns:
        期間が未来にある場合は true,その他 false を返します.
      • isFuture

        public final boolean isFuture(int f,
                                      int t)
        このオブジェクトが表す日付より指定された期間が未来にあるかどうか判定します.
        Parameters:
        f - 期間(始まり)
        t - 期間(終わり)
        Returns:
        期間が未来にある場合は true,その他 false を返します.
      • isPast

        public static final boolean isPast(int d,
                                           int f,
                                           int t)
        指定された日付 d より指定された期間が過去にあるかどうか判定します.
        Parameters:
        d - 日付
        f - 期間(始まり)
        t - 期間(終わり)
        Returns:
        期間が過去にある場合は true,その他 false を返します.
      • isPast

        public final boolean isPast(int f,
                                    int t)
        このオブジェクトが表す日付より指定された期間が過去にあるかどうか判定します.
        Parameters:
        f - 期間(始まり)
        t - 期間(終わり)
        Returns:
        期間が過去にある場合は true,その他 false を返します.
      • isOverlap

        public static final boolean isOverlap(int f1,
                                              int t1,
                                              int f2,
                                              int t2)
        指定された期間が重なる部分をもつかどうかを判定します.
        Parameters:
        f1 - 期間 1 (始まり)
        t1 - 期間 1 (終わり)
        f2 - 期間 2 (始まり)
        t2 - 期間 2 (終わり)
        Returns:
        重なる部分をもつ場合は true,その他 false を返します.
      • isOverlap

        public static final boolean isOverlap(EdbDate f1,
                                              EdbDate t1,
                                              EdbDate f2,
                                              EdbDate t2)
        指定された期間が重なる部分をもつかどうかを判定します.
        Parameters:
        f1 - 期間 1 (始まり)
        t1 - 期間 1 (終わり)
        f2 - 期間 2 (始まり)
        t2 - 期間 2 (終わり)
        Returns:
        重なる部分をもつ場合は true,その他 false を返します.
      • equals

        public final boolean equals(EdbDate d)
        このオブジェクトが表す日付と等しいかどうか判定します.
        Parameters:
        d - 日付
        Returns:
        等しい場合は true,その他 false を返します.
      • equals

        public final boolean equals(int d)
        このオブジェクトが表す日付と等しいかどうか判定します.
        Parameters:
        d - 日付
        Returns:
        等しい場合は true,その他 false を返します.
      • hashCode

        public final int hashCode()
        このオブジェクトのハッシュコードを取得します.

        ここでは,日付をハッシュコードとして戻しています.

        Overrides:
        hashCode in class Object
        Returns:
        ハッシュコードを返します.
      • compareTo

        public final int compareTo(int d)
        このオブジェクトが表す日付と指定された日付を比較します.
        Parameters:
        d - 日付
        Returns:
        このオブジェクトが表す日付が小さい場合は負の整数,等しい場合はゼロ,大きい場合は正の整数を返します.
      • toText

        public final String toText(EdbDate.FMT fmt)
        このオブジェクトが表す日付を指定されたフォーマットの文字列に変換します.
        Parameters:
        fmt - フォーマット,フォーマットの定数の値を指定
        Returns:
        変換に成功した場合は変換された文字列を返します.失敗した場合は空の文字列("")を返します.
        See Also:
        EdbDate.FMT
      • toUDate

        public UDate toUDate()
        Convert to Udate.
        Returns:
        UDate object.
      • toLocalDateTime

        public LocalDateTime toLocalDateTime()
        Convert to LocalDateTime.
        Returns:
        LocalDateTime object.
EDB/Java

EDB Working Group at Tue Jun 10 17:08:59 JST 2025