パッケージ org.aiwolf.common.util

クラス CalendarTools

java.lang.Object
org.aiwolf.common.util.CalendarTools

public class CalendarTools extends Object
カレンダーに関する静的なメソッドを提供するクラスです。
CalendarTools is that provides a static method on the calendar.
作成者:
tori
  • コンストラクタの概要

    コンストラクタ
    コンストラクタ
    説明
     
  • メソッドの概要

    修飾子とタイプ
    メソッド
    説明
    static boolean
    isSameDay(Calendar date1, Calendar date2)
    同一日かどうかを返します。
    static Calendar
    toCalendar(long timeInMillis)
    long型のミリ秒をCalendar型のオブジェクトに変換します。
    static Calendar
    toCalendar(String dateTimeString)
    年-月-日-時-分-秒の順で並んだ日付をCalendarオブジェクトに変換します。
    static Calendar
    Date型のオブジェクトをCalendar型のオブジェクトに変換します。
    static String
    Calendarオブジェクトをyyyy/MM/dd形式の文字列に変換し、返します。
    static String
    Dateオブジェクトをyyyy/MM/dd形式の文字列に変換し、返します。
    static String
    toDateTime(long time)
    指定されたlong型の値をyyyy/MM/dd HH:mm:ss形式の文字列に直して返します。
    static String
    指定されたCalendarオブジェクトをyyyy/MM/dd HH:mm:ss形式の文字列に直して返します。
    static String
    指定されたDateオブジェクトをyyyy/MM/dd HH:mm:ss形式の文字列に直して返します。
    static Calendar
    toMidnight(Calendar calendar)
    指定されたCalendarをその日の深夜(00:00:00.000)に時間を設定します。

    クラスから継承されたメソッド java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • コンストラクタの詳細

    • CalendarTools

      public CalendarTools()
  • メソッドの詳細

    • toDateTime

      public static String toDateTime(Calendar cal)
      指定されたCalendarオブジェクトをyyyy/MM/dd HH:mm:ss形式の文字列に直して返します。
      Converts to yyyy/MM/dd HH:mm:ss format.
      パラメータ:
      cal -
      対象とするCalendarオブジェクト
      Calender object
      戻り値:
      文字列フォーマット
      String format
    • toDateTime

      public static String toDateTime(Date date)
      指定されたDateオブジェクトをyyyy/MM/dd HH:mm:ss形式の文字列に直して返します。
      Converts to yyyy/MM/dd HH:mm:ss format.
      パラメータ:
      date -
      対象とするDateオブジェクト
      Date object
      戻り値:
      文字列フォーマット
      String format
    • toDateTime

      public static String toDateTime(long time)
      指定されたlong型の値をyyyy/MM/dd HH:mm:ss形式の文字列に直して返します。
      Converts to yyyy/MM/dd HH:mm:ss format.
      パラメータ:
      time -
      対象とするlong型の値
      Long value
      戻り値:
      文字列フォーマット
      String format
    • toCalendar

      public static Calendar toCalendar(String dateTimeString)
      年-月-日-時-分-秒の順で並んだ日付をCalendarオブジェクトに変換します。
      区切り文字は数字以外のすべての文字または空白にしてください。 足りない分はすべて0で補完されます。
      Converts to Calendar object.
      パラメータ:
      dateTimeString -
      年-月-日-時-分-秒の順で並んだ日付
      Date time string
      戻り値:
      変換されたCalendarオブジェクト
      Converted calendar object
    • toCalendar

      public static Calendar toCalendar(Date date)
      Date型のオブジェクトをCalendar型のオブジェクトに変換します。
      Converts from Date object to Calendar object.
      パラメータ:
      date -
      Date型のオブジェクト
      Date object
      戻り値:
      Calendar型のオブジェクト
      Calendar object
    • toCalendar

      public static Calendar toCalendar(long timeInMillis)
      long型のミリ秒をCalendar型のオブジェクトに変換します。
      Converts from milis to Calendar object.
      パラメータ:
      timeInMillis -
      ミリ秒
      Millis
      戻り値:
      Calendar型のオブジェクト
      Calendar object
    • toMidnight

      public static Calendar toMidnight(Calendar calendar)
      指定されたCalendarをその日の深夜(00:00:00.000)に時間を設定します。
      Sets time the midnight of the day.
      パラメータ:
      calendar -
      深夜に時間を設定するCalendar
      Calendar
      戻り値:
      深夜に時間を設定したカレンダー
      Calendar which set the time
    • toDateString

      public static String toDateString(Calendar cal)
      Calendarオブジェクトをyyyy/MM/dd形式の文字列に変換し、返します。
      Converts from Calendar object to yyyy/MM/dd format String.
      パラメータ:
      cal -
      対象となるCalendarオブジェクト
      Calendar object
      戻り値:
      文字列フォーマット
      String format
    • toDateString

      public static String toDateString(Date date)
      Dateオブジェクトをyyyy/MM/dd形式の文字列に変換し、返します。
      Converts from Date object to yyyy/MM/dd format String.
      パラメータ:
      date -
      対象となるDateオブジェクト
      Date object
      戻り値:
      文字列フォーマット
      String format
    • isSameDay

      public static boolean isSameDay(Calendar date1, Calendar date2)
      同一日かどうかを返します。
      Is same day?
      パラメータ:
      date1 -
      date2と比較するCalendarオブジェクト
      Calendar object which compares date2
      date2 -
      date1と比較するCalendarオブジェクト
      Calendar object which compares date1
      戻り値:
      同一日かどうか
      Same day or other day