类 DateUtils

java.lang.Object
org.nutz.lang.Times
club.zhcs.lina.utils.DateUtils

public class DateUtils extends org.nutz.lang.Times
作者:
Kerbores(kerbores@riemann.tech)
  • 字段详细资料

  • 构造器详细资料

    • DateUtils

      public DateUtils()
  • 方法详细资料

    • addDays

      public static Date addDays(Date base, int days)
      日期加减
      参数:
      base - 开始日期
      days - 增加天数 正数为之后日期负数为之前日期
      返回:
      目标日期
    • addDays

      public static Date addDays(int days)
      从今日开始的日期加减
      参数:
      days - 增加天数 正数为之后日期负数为之前日期
      返回:
      目标日期
    • daysBetween

      public static double daysBetween(Date start, Date end)
      两个日期之间的天数差
      参数:
      start - 开始日期
      end - 结束日期
      返回:
      天数
    • getDayStart

      public static Date getDayStart(Date d)
      获取当日凌晨
      参数:
      d - 日期
      返回:
      当日凌晨 date 对象
    • getDayEnd

      public static Date getDayEnd(Date d)
    • getDayStart

      public static Date getDayStart()
      获取今日凌晨
      返回:
      今日凌晨0:0:0的时间实例
    • getDayEnd

      public static Date getDayEnd()
    • getWeekEnd

      public static Date getWeekEnd(boolean startFromSunday)
      获取当前日期的周结束(周日或者周六)
      参数:
      startFromSunday - 从周日开始计算周 标识
      返回:
      startFromSunday 为true 则返回下一个周六 为false则返回下一个周日
    • getWeekEnd

      public static Date getWeekEnd(boolean startFromSunday, Date date)
    • getWeekStart

      public static Date getWeekStart(boolean startFromSunday)
      获取当前日期的周开始(周一或者周日)
      参数:
      startFromSunday - 从周日开始计算周 标识
      返回:
      startFromSunday 为true 则返回上一个周日 为false则返回上一个周一
    • getWeekStart

      public static Date getWeekStart(boolean startFromSunday, Date date)
    • addSeconds

      public static Date addSeconds(Date base, long seconds)
      增加秒
      参数:
      base - 基础时间
      seconds - 秒数
      返回:
      日期对象
    • addSeconds

      public static Date addSeconds(long seconds)
      增加秒
      参数:
      seconds - 秒数
      返回:
      日期对象
    • getYearStart

      public static Date getYearStart(Date d)
      获取元旦日期
      参数:
      d - 日期
      返回:
      元旦日期
    • getYearStart

      public static Date getYearStart()
      获取元旦日期
      返回:
      元旦日期
    • getYearEnd

      public static Date getYearEnd(Date d)
      获取年末日期
      参数:
      d - 日期
      返回:
      年末日期
    • getYearEnd

      public static Date getYearEnd()
      获取年末日期
      返回:
      年末日期
    • getMonthStart

      public static Date getMonthStart(Date d)
      获取月初日期
      参数:
      d - 日期
      返回:
      月初日期
    • getMonthStart

      public static Date getMonthStart()
      获取月初日期
      返回:
      月初日期
    • getMonthEnd

      public static Date getMonthEnd(Date d)
      获取月末日期
      参数:
      d - 日期
      返回:
      月末日期
    • getMonthEnd

      public static Date getMonthEnd()
      获取月末日期
      返回:
      月末日期
    • getSequence

      public static String getSequence()
    • getYearStartMonth

      public static String getYearStartMonth()
    • getYearStartMonth

      public static String getYearStartMonth(Date date)
    • getYearEndMonth

      public static String getYearEndMonth()
    • getYearEndMonth

      public static String getYearEndMonth(Date date)
    • getMonthStartDate

      public static String getMonthStartDate()
    • getMonthStartDate

      public static String getMonthStartDate(Date date)
    • getMonthEndDate

      public static String getMonthEndDate()
    • getMonthEndDate

      public static String getMonthEndDate(Date date)
    • getDayOfMonth

      public static int getDayOfMonth()