Class DateUtil


  • public class DateUtil
    extends java.lang.Object
    日付操作用のユーティリティです。
    • Constructor Summary

      Constructors 
      Constructor Description
      DateUtil()  
    • Method Summary

      Modifier and Type Method Description
      static java.util.Calendar getCalendar​(boolean useTenantTimeZone)  
      static java.util.Calendar getCalendar​(java.util.Locale locale, boolean useTenantTimeZone)  
      static java.sql.Date getCurrentDate()
      テナントローカルの現在日付を返します。
      同一リクエスト処理中は常に同じ値(リクエスト処理中に最初に当該メソッドが呼ばれた日付)を返します。
      現在日付をjava.sql.Dateで表現するためのものです。 システムのタイムゾーンとテナントローカルタイムゾーンが異なる場合、タイムゾーンのオフセット分シフトされた値となります。
      static java.sql.Time getCurrentTime()
      テナントローカルの現在時間を返します。
      同一リクエスト処理中は常に同じ値(リクエスト処理中に最初に当該メソッドが呼ばれた日付)を返します。
      現在時刻をjava.sql.Timeで表現するためのものです。 1970-01-01 00:00:00~23:59:59の間の値となります。 システムのタイムゾーンとテナントローカルタイムゾーンが異なる場合、テナントローカルのタイムゾーンのオフセット分シフトされた値となります。
      static java.sql.Timestamp getCurrentTimestamp()
      現在日時を返します。 同一リクエスト処理中は常に同じ値(リクエスト処理中に最初に当該メソッドが呼ばれた日時)を返します。
      static java.text.DateFormat getDateInstance​(int style, boolean useTenantTimeZone)  
      static java.text.DateFormat getDateInstance​(int style, java.util.Locale locale, boolean useTenantTimeZone)  
      static java.text.DateFormat getDateTimeInstance​(int dateStyle, int timeStyle, boolean useTenantTimeZone)  
      static java.text.DateFormat getDateTimeInstance​(int dateStyle, int timeStyle, java.util.Locale locale, boolean useTenantTimeZone)  
      static java.text.DateFormat getDateTimeInstance​(int dateStyle, int timeStyle, java.util.Locale locale, java.util.TimeZone timeZone, boolean useTenantTimeZone)  
      static java.util.GregorianCalendar getGregorianCalendar​(boolean useTenantTimeZone)  
      static java.text.SimpleDateFormat getSimpleDateFormat​(java.lang.String pattern, boolean useTenantTimeZone)
      指定のpatternのSimpleDateFormatのインスタンスを取得します。 ロケールは、テナントに設定されるロケール(未設定の場合はシステムデフォルトロケール)が利用されます。
      static java.text.SimpleDateFormat getSimpleDateFormat​(java.lang.String pattern, boolean useTenantTimeZone, boolean useUserLangLocale)
      指定のpatternのSimpleDateFormatのインスタンスを取得します。
      static java.text.DateFormat getTimeInstance​(boolean useTenantTimeZone)  
      static java.text.DateFormat getTimeInstance​(int style, boolean useTenantTimeZone)  
      static java.text.DateFormat getTimeInstance​(int style, java.util.Locale locale, boolean useTenantTimeZone)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DateUtil

        public DateUtil()
    • Method Detail

      • getCurrentTimestamp

        public static java.sql.Timestamp getCurrentTimestamp()
        現在日時を返します。 同一リクエスト処理中は常に同じ値(リクエスト処理中に最初に当該メソッドが呼ばれた日時)を返します。
        Returns:
      • getCurrentDate

        public static java.sql.Date getCurrentDate()
        テナントローカルの現在日付を返します。
        同一リクエスト処理中は常に同じ値(リクエスト処理中に最初に当該メソッドが呼ばれた日付)を返します。
        現在日付をjava.sql.Dateで表現するためのものです。 システムのタイムゾーンとテナントローカルタイムゾーンが異なる場合、タイムゾーンのオフセット分シフトされた値となります。
        Returns:
      • getCurrentTime

        public static java.sql.Time getCurrentTime()
        テナントローカルの現在時間を返します。
        同一リクエスト処理中は常に同じ値(リクエスト処理中に最初に当該メソッドが呼ばれた日付)を返します。
        現在時刻をjava.sql.Timeで表現するためのものです。 1970-01-01 00:00:00~23:59:59の間の値となります。 システムのタイムゾーンとテナントローカルタイムゾーンが異なる場合、テナントローカルのタイムゾーンのオフセット分シフトされた値となります。
        Returns:
      • getSimpleDateFormat

        public static java.text.SimpleDateFormat getSimpleDateFormat​(java.lang.String pattern,
                                                                     boolean useTenantTimeZone)
        指定のpatternのSimpleDateFormatのインスタンスを取得します。 ロケールは、テナントに設定されるロケール(未設定の場合はシステムデフォルトロケール)が利用されます。
        Parameters:
        pattern -
        useTenantTimeZone - システムのデフォルトタイムゾーンではなく、テナントに設定されるタイムゾーンを利用する場合はtrueを指定します
        Returns:
      • getSimpleDateFormat

        public static java.text.SimpleDateFormat getSimpleDateFormat​(java.lang.String pattern,
                                                                     boolean useTenantTimeZone,
                                                                     boolean useUserLangLocale)
        指定のpatternのSimpleDateFormatのインスタンスを取得します。
        Parameters:
        pattern -
        useTenantTimeZone - システムのデフォルトタイムゾーンではなく、テナントに設定されるタイムゾーンを利用する場合はtrueを指定します
        useUserLangLocale - テナントに設定されるロケールではなく、当該処理を実行しているユーザの言語に紐付くロケールを利用する場合はtrueを指定します。
        Returns:
      • getCalendar

        public static java.util.Calendar getCalendar​(boolean useTenantTimeZone)
      • getCalendar

        public static java.util.Calendar getCalendar​(java.util.Locale locale,
                                                     boolean useTenantTimeZone)
      • getGregorianCalendar

        public static java.util.GregorianCalendar getGregorianCalendar​(boolean useTenantTimeZone)
      • getDateInstance

        public static java.text.DateFormat getDateInstance​(int style,
                                                           boolean useTenantTimeZone)
      • getDateInstance

        public static java.text.DateFormat getDateInstance​(int style,
                                                           java.util.Locale locale,
                                                           boolean useTenantTimeZone)
      • getDateTimeInstance

        public static java.text.DateFormat getDateTimeInstance​(int dateStyle,
                                                               int timeStyle,
                                                               boolean useTenantTimeZone)
      • getDateTimeInstance

        public static java.text.DateFormat getDateTimeInstance​(int dateStyle,
                                                               int timeStyle,
                                                               java.util.Locale locale,
                                                               boolean useTenantTimeZone)
      • getDateTimeInstance

        public static java.text.DateFormat getDateTimeInstance​(int dateStyle,
                                                               int timeStyle,
                                                               java.util.Locale locale,
                                                               java.util.TimeZone timeZone,
                                                               boolean useTenantTimeZone)
      • getTimeInstance

        public static java.text.DateFormat getTimeInstance​(boolean useTenantTimeZone)
      • getTimeInstance

        public static java.text.DateFormat getTimeInstance​(int style,
                                                           boolean useTenantTimeZone)
      • getTimeInstance

        public static java.text.DateFormat getTimeInstance​(int style,
                                                           java.util.Locale locale,
                                                           boolean useTenantTimeZone)