类 LocalDateUtils

java.lang.Object
com.cdkjframework.util.date.LocalDateUtils

@Component public class LocalDateUtils extends Object
  • 字段详细资料

  • 构造器详细资料

    • LocalDateUtils

      public LocalDateUtils()
  • 方法详细资料

    • getCurrentDateTime

      public static LocalDateTime getCurrentDateTime()
      获取到当前时间 yyyy-MM-dd HH:mm:ss
      返回:
      返回结果
    • dateTimeParse

      public static LocalDateTime dateTimeParse(String dateTime)
      格式化 2019-11-19T15:16:17
      参数:
      dateTime - 时间
      返回:
    • parseDateTime

      public static LocalDateTime parseDateTime(String dateTime)
      date 日期转换
      参数:
      dateTime - 时间
      返回:
      返回结果
    • dateTimeParse

      public static LocalDateTime dateTimeParse(String dateTime, String pattern)
      返回结果
      参数:
      dateTime - 时间
      pattern - 指定格式
      返回:
    • getCurrentDate

      public static LocalDate getCurrentDate()
      获取当前日期
      返回:
      返回结果
    • dateParse

      public static LocalDate dateParse(String date)
      日期格式 2019-11-19
      参数:
      date - 指定日期
      返回:
      返回日期
    • dateParse

      public static LocalDate dateParse(String year, String month, String day)
      日期格式
      参数:
      year - 年
      month - 月
      day - 日
      返回:
      返回结果
    • dateParse

      public static LocalDate dateParse(int year, int month, int day)
      日期格式
      参数:
      year - 年
      month - 月
      day - 日
      返回:
      返回结果
    • localDateToTimestamp

      public static long localDateToTimestamp(LocalDate localDate)
      将指定时间转换为时间戳
      参数:
      localDate - 日期
      返回:
      返回结果
    • localDateTimeToTimestamp

      public static long localDateTimeToTimestamp(LocalDateTime localDateTime)
      将指定时间转换为时间戳
      参数:
      localDateTime - 日期时间
      返回:
      返回结果
    • dateTimeToDate

      public static Date dateTimeToDate()
      将 LocalDateTime 时间转换为 Date
      返回:
      返回结果
    • dateTimeToDate

      public static Date dateTimeToDate(LocalDateTime localDateTime)
      将 LocalDateTime 时间转换为 Date
      参数:
      localDateTime - 时间
      返回:
      返回结果
    • dateTimeToDate

      public static Date dateTimeToDate(String localDateTime)
      将 LocalDateTime 时间转换为 Date
      参数:
      localDateTime - 时间
      返回:
      返回结果
    • dateTimeToDate

      public static Date dateTimeToDate(LocalDateTime localDateTime, String pattern)
      将 LocalDateTime 时间转换为 Date
      参数:
      localDateTime - 时间
      pattern - 时间格式化
      返回:
      返回结果
    • dateTimeToDate

      public static Date dateTimeToDate(String localDateTime, String pattern)
      将 LocalDateTime 时间转换为 Date
      参数:
      localDateTime - 时间
      pattern - 时间格式化
      返回:
      返回结果
    • getCurrentTime

      public static LocalTime getCurrentTime()
      获取当前时间
      返回:
      返回结果
    • timeParse

      public static LocalTime timeParse(String time)
      日期格式
      参数:
      time - 时间
      返回:
      返回结果
    • timeParse

      public static LocalTime timeParse(String hour, String minute, String second)
      时间格式
      参数:
      hour - 时
      minute - 分
      second - 秒
      返回:
      返回结果
    • timeParse

      public static LocalTime timeParse(int hour, int minute, int second)
      时间格式
      参数:
      hour - 时
      minute - 分
      second - 秒
      返回:
      返回结果
    • dateTimeCurrentFormatter

      public static String dateTimeCurrentFormatter()
      格式化当前时间为固定格式
      返回:
      返回结果字符串
    • dateTimeCurrentFormatter

      public static String dateTimeCurrentFormatter(String pattern)
      格式化当前时间为指定格式
      返回:
      返回结果字符串
    • dateTimeFormatter

      public static String dateTimeFormatter(LocalDateTime dateTime)
      格式化指定时间为固定格式
      返回:
      返回结果字符串
    • dateTimeFormatter

      public static String dateTimeFormatter(LocalDateTime dateTime, String pattern)
      格式化指定时间为指定格式
      返回:
      返回结果字符串
    • subtractYear

      public static long subtractYear(LocalDateTime dateTime)
      指定时间与当前时间相减
      参数:
      dateTime - 指定时间
      返回:
    • subtractDay

      public static long subtractDay(LocalDateTime dateTime)
      指定时间与当前时间相减
      参数:
      dateTime - 指定时间
      返回:
    • subtractHour

      public static long subtractHour(LocalDateTime dateTime)
      指定时间与当前时间相减
      参数:
      dateTime - 指定时间
      返回:
      小时
    • subtractMinute

      public static long subtractMinute(LocalDateTime dateTime)
      指定时间与当前时间相减
      参数:
      dateTime - 指定时间
      返回:
      分钟
    • subtract

      public static Duration subtract(LocalDateTime dateTime)
      指定时间与当前时间相减
      参数:
      dateTime - 指定时间
      返回:
      返回结果
    • subtract

      public static Duration subtract(LocalDateTime startDateTime, LocalDateTime endDateTime)
      指定时间与当前时间相减
      参数:
      startDateTime - 指定时间
      endDateTime - 指定时间
      返回:
      返回结果
    • subtractYear

      public static long subtractYear(LocalDateTime startDateTime, LocalDateTime endDateTime)
      指定时间与当前时间相减
      参数:
      startDateTime - 指定时间
      endDateTime - 指定时间
      返回:
    • subtractDay

      public static long subtractDay(LocalDateTime startDateTime, LocalDateTime endDateTime)
      指定时间与当前时间相减
      参数:
      startDateTime - 指定时间
      endDateTime - 指定时间
      返回:
    • subtractHour

      public static long subtractHour(LocalDateTime startDateTime, LocalDateTime endDateTime)
      指定时间与当前时间相减
      参数:
      startDateTime - 指定时间
      endDateTime - 指定时间
      返回:
      小时
    • subtractMinute

      public static long subtractMinute(LocalDateTime startDateTime, LocalDateTime endDateTime)
      指定时间与当前时间相减
      参数:
      startDateTime - 指定时间
      endDateTime - 指定时间
      返回:
      分钟
    • designatedToDay

      public static long designatedToDay(int month)
      指定月份天数
      参数:
      month - 月份
      返回:
      返回结果
    • designatedToDay

      public static long designatedToDay(int year, int month)
      指定年月份天数
      参数:
      year - 年份
      month - 月份
      返回:
      返回结果
    • designatedToWeek

      public static long designatedToWeek(int month)
      指定月份周
      参数:
      month - 月份
      返回:
      返回结果
    • designatedToWeek

      public static long designatedToWeek(int year, int month)
      指定年月份周
      参数:
      year - 年份
      month - 月份
      返回:
      返回结果
    • greater

      public static boolean greater(LocalDateTime startDateTime, LocalDateTime endDateTime)
      时间比较
      参数:
      startDateTime - 开始时间
      endDateTime - 结束时间
      返回:
      返回结果
    • greater

      public static boolean greater(LocalDate startDate, LocalDate endDate)
      时间比较 2
      参数:
      startDate - 开始时间
      endDate - 结束时间
      返回:
      返回结果
    • greater

      public static boolean greater(LocalTime startTime, LocalTime endTime)
      时间比较 3
      参数:
      startTime - 开始时间
      endTime - 结束时间
      返回:
      返回结果
    • timestampToLocalDateTime

      public static LocalDateTime timestampToLocalDateTime(long timestamp)
      时间戳转换为时间
      参数:
      timestamp - 时间戳
      返回:
      返回时间
    • timestampToDateTimeString

      public static String timestampToDateTimeString(long timestamp)
      时间戳转换为时间字符
      参数:
      timestamp - 时间戳
      返回:
      返回时间字符
    • timestampToDateTimeString

      public static String timestampToDateTimeString(long timestamp, String pattern)
      时间戳转换为时间字符
      参数:
      timestamp - 时间戳
      pattern - 时间格式
      返回:
      返回时间字符
    • timestampToLocalDate

      public static LocalDate timestampToLocalDate(long timestamp)
      时间戳转换为日期
      参数:
      timestamp - 时间戳
      返回:
      返回时间
    • timestampToDateString

      public static String timestampToDateString(long timestamp)
      时间戳转换为日期字符
      参数:
      timestamp - 时间戳
      返回:
      返回时间字符
    • timestampToDateString

      public static String timestampToDateString(long timestamp, String pattern)
      时间戳转换为日期字符
      参数:
      timestamp - 时间戳
      pattern - 时间格式
      返回:
      返回日期字符