Class DateUtils


  • public final class DateUtils
    extends java.lang.Object
    DateUtils.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static long acquireMillisBetween​(java.time.LocalDateTime start, java.time.LocalDateTime end)
      Acquire millis between long.
      static long acquireMinutesBetween​(java.time.LocalDateTime start, java.time.LocalDateTime end)
      acquireMinutesBetween.
      static java.time.LocalDateTime formatLocalDateTimeFromTimestamp​(java.lang.Long timestamp)
      Format local date time from timestamp local date time.
      static java.time.LocalDateTime formatLocalDateTimeFromTimestampBySystemTimezone​(java.lang.Long timestamp)
      Format local date time from timestamp by system time zone.
      static java.lang.String localDateTimeToString​(java.time.LocalDateTime localDateTime)
      Format local date time to string.
      static java.lang.String localDateTimeToString​(java.time.LocalDateTime localDateTime, java.lang.String pattern)
      Format local date time to string.
      static java.time.LocalDateTime parseLocalDateTime​(java.lang.String dataTime)
      parse LocalDateTime.
      static java.time.LocalDateTime parseLocalDateTime​(java.lang.String dataTime, java.lang.String dateTimeFormatter)
      Parse local date time local date time.
      • Methods inherited from class java.lang.Object

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

      • DATE_FORMAT_DATETIME

        public static final java.lang.String DATE_FORMAT_DATETIME
        See Also:
        Constant Field Values
      • DATE_FORMAT_DATETIME_MILLISECOND

        public static final java.lang.String DATE_FORMAT_DATETIME_MILLISECOND
        See Also:
        Constant Field Values
    • Method Detail

      • parseLocalDateTime

        public static java.time.LocalDateTime parseLocalDateTime​(java.lang.String dataTime)
        parse LocalDateTime. out put format: yyyy-MM-dd HH:mm:ss
        Parameters:
        dataTime - date String
        Returns:
        LocalDateTime: yyyy-MM-dd HH:mm:ss
        See Also:
        LocalDateTime
      • parseLocalDateTime

        public static java.time.LocalDateTime parseLocalDateTime​(java.lang.String dataTime,
                                                                 java.lang.String dateTimeFormatter)
        Parse local date time local date time.
        Parameters:
        dataTime - the data time
        dateTimeFormatter - the date time formatter
        Returns:
        the local date time
      • acquireMinutesBetween

        public static long acquireMinutesBetween​(java.time.LocalDateTime start,
                                                 java.time.LocalDateTime end)
        acquireMinutesBetween.
        Parameters:
        start - this is start date.
        end - this is start date.
        Returns:
        The number of days between start and end, if end is after start, returns a positive number, otherwise returns a negative number.
      • acquireMillisBetween

        public static long acquireMillisBetween​(java.time.LocalDateTime start,
                                                java.time.LocalDateTime end)
        Acquire millis between long.
        Parameters:
        start - the start
        end - the end
        Returns:
        the long
      • formatLocalDateTimeFromTimestamp

        public static java.time.LocalDateTime formatLocalDateTimeFromTimestamp​(java.lang.Long timestamp)
        Format local date time from timestamp local date time.
        Parameters:
        timestamp - the timestamp
        Returns:
        the local date time
      • formatLocalDateTimeFromTimestampBySystemTimezone

        public static java.time.LocalDateTime formatLocalDateTimeFromTimestampBySystemTimezone​(java.lang.Long timestamp)
        Format local date time from timestamp by system time zone.
        Parameters:
        timestamp - the timestamp
        Returns:
        the local date time
      • localDateTimeToString

        public static java.lang.String localDateTimeToString​(java.time.LocalDateTime localDateTime)
        Format local date time to string. use default pattern yyyy-MM-dd HH:mm:ss
        Parameters:
        localDateTime - the localDateTime
        Returns:
        the format string
      • localDateTimeToString

        public static java.lang.String localDateTimeToString​(java.time.LocalDateTime localDateTime,
                                                             java.lang.String pattern)
        Format local date time to string.
        Parameters:
        localDateTime - the localDateTime
        pattern - formatter pattern
        Returns:
        the format string