类 JDateUtil


  • public class JDateUtil
    extends Object
    • 构造器详细资料

      • JDateUtil

        public JDateUtil()
    • 方法详细资料

      • asDate

        public static Date asDate​(LocalDate localDate)
        Convert LocalDate to Date object.
        参数:
        localDate - The LocalDate object.
        返回:
        Date object.
      • asDate

        public static Date asDate​(LocalDateTime localDateTime)
        Convert LocalDateTime to Date object.
        参数:
        localDateTime - The LocalDateTime object.
        返回:
        Date object.
      • asLocalDate

        public static LocalDate asLocalDate​(Date date)
        Convert Date to LocalDate object.
        参数:
        date - The Date object.
        返回:
        LocalDate object.
      • asLocalDateTime

        public static LocalDateTime asLocalDateTime​(Date date)
        Convert Date to LocalDateTime object.
        参数:
        date - The Date object.
        返回:
        LocalDateTime object.
      • asLocalDateTime

        public static LocalDateTime asLocalDateTime​(long ms)
        Convert milli seconds to LocalDateTime object.
        参数:
        ms - The milli seconds.
        返回:
        LocalDateTime object.
      • fromOADate

        public static LocalDateTime fromOADate​(double oaDate)
        Convert OA date to date
        参数:
        oaDate - OA date
        返回:
        Date
      • asMilliSeconds

        public static long asMilliSeconds​(LocalDateTime ldt)
        Convert LocalDateTime to milli seconds
        参数:
        ldt - Local date time
        返回:
        Milli seconds
      • toOADate

        public static double toOADate​(LocalDateTime ldt)
        Convert LocalDateTime to OA date
        参数:
        ldt - Local date time
        返回:
        OA date
      • getDaysOfMonth

        public static int getDaysOfMonth​(int year,
                                         int month)
        Get days of a month
        参数:
        year - The year
        month - The month
        返回:
        The days in the month
      • getDaysOfYear

        public static int getDaysOfYear​(int year)
        Get days of a year
        参数:
        year - The year
        返回:
        The days in the year
      • getTimeDeltaValues

        public static List<Integer> getTimeDeltaValues​(List<LocalDateTime> times,
                                                       LocalDateTime baseDate,
                                                       String tDelta)
        Get time values - Time delta values of base date
        参数:
        times - Time list
        baseDate - Base date
        tDelta - Time delta type - days/hours/...
        返回:
        The time delta values
      • getTimeDeltaValue

        public static int getTimeDeltaValue​(LocalDateTime t,
                                            LocalDateTime baseDate,
                                            String tDelta)
        Get time value - Time delta value of base date
        参数:
        t - The time
        baseDate - Base date
        tDelta - Time delta type - days/hours/...
        返回:
        The time delta value
      • getDays

        public static int getDays​(LocalDateTime t,
                                  LocalDateTime baseDate)
        Get days difference between two dates
        参数:
        t - The time
        baseDate - Base date
        返回:
        The time delta value
      • getHours

        public static int getHours​(LocalDateTime t,
                                   LocalDateTime baseDate)
        Get hours difference between two dates
        参数:
        t - The time
        baseDate - Base date
        返回:
        The time delta value
      • equals

        public static boolean equals​(LocalDateTime a,
                                     LocalDateTime b)
        Date equals
        参数:
        a - Date a
        b - Date b
        返回:
        If equals
      • dayOfYear

        public static int dayOfYear​(int year,
                                    int month,
                                    int day)
        Get day of year
        参数:
        year - Year
        month - Month
        day - Day
        返回:
        Day of year
      • doy2date

        public static LocalDate doy2date​(int year,
                                         int doy)
        Convert day of year to date
        参数:
        year - Year
        doy - Day of year
        返回:
        The date
      • getPeriodType

        public static ChronoUnit getPeriodType​(String p)
        Get period type from string
        参数:
        p - Period type string
        返回:
        PeriodType
      • getPeriod

        public static TemporalAmount getPeriod​(String pStr)
        Get period from string
        参数:
        pStr - Period string
        返回:
        Period
      • getChronoUnit

        public static ChronoUnit getChronoUnit​(TemporalAmount ta)
        Get Chrono unit
        参数:
        ta - The Temporal amount
        返回:
        Chrono unit
      • getDateFormat

        public static String getDateFormat​(TemporalAmount p)
        Get date format string
        参数:
        p - Period
        返回:
        Date format string
      • getDateTime

        public static LocalDateTime getDateTime​(String dts)
        Get date time from string
        参数:
        dts - Date time string
        返回:
        DateTime
      • getDateTime_

        public static LocalDateTime getDateTime_​(String dts)
        Get date time from string
        参数:
        dts - Date time string
        返回:
        DateTime
      • getDateTimes

        public static List<LocalDateTime> getDateTimes​(LocalDateTime start,
                                                       int tNum,
                                                       TemporalAmount p)
        Get date time list
        参数:
        start - Start date time
        tNum - Date time number
        p - Peroid
        返回:
        Date time list
      • getDateTimes

        public static List<LocalDateTime> getDateTimes​(int tNum,
                                                       LocalDateTime end,
                                                       TemporalAmount p)
        Get date time list
        参数:
        end - End date time
        tNum - Date time number
        p - Peroid
        返回:
        Date time list
      • parseDateTime

        public static LocalDateTime parseDateTime​(String dtStr,
                                                  DateTimeFormatter formatter)
        Parse string to LocalDateTime
        参数:
        dtStr - The string
        formatter - DateTimeFormatter
        返回:
        LocalDateTime
      • parseDateTime_bak

        public static LocalDateTime parseDateTime_bak​(String dtStr,
                                                      DateTimeFormatter formatter)
        Parse string to LocalDateTime
        参数:
        dtStr - The string
        formatter - DateTimeFormatter
        返回:
        LocalDateTime