程序包 org.xmeta.util

类 UtilDate

java.lang.Object
org.xmeta.util.UtilDate

public class UtilDate extends Object
  • 字段详细资料

  • 构造器详细资料

    • UtilDate

      public UtilDate()
  • 方法详细资料

    • getLastTimeInfo

      public static String getLastTimeInfo(long time)
      返回持续时间的信息,如36分32秒这样的字符串。
      参数:
      time - 时间
      返回:
      格式化后的字符串
    • getWeekStart

      public static Date getWeekStart()
      获取本星期的第一天。
      返回:
      日期
    • getWeekEnd

      public static Date getWeekEnd()
      获取本星期的最后一天。
      返回:
      日期
    • getMonthStart

      public static Date getMonthStart()
      获取本月的第一天。
      返回:
      日期
    • getMonthEnd

      public static Date getMonthEnd()
      获取本月的最后一天。
      返回:
      日期
    • getYearStart

      public static Date getYearStart()
      获取当年的第一天。
      返回:
      日期
    • getYearEnd

      public static Date getYearEnd()
      获取本年的最后一天。
      返回:
      日期
    • getMonthDayCount

      public static int getMonthDayCount(Date date)
      返回指定日期所在月的天数。
      参数:
      date - 日期
      返回:
      天数
    • getDateString

      public static String getDateString(Date date, String format)
    • isBetween

      public static boolean isBetween(Date adate, Date start, Date end)
      是否是在一个时间段范围里。
      参数:
      adate - 第一个日期
      start - 第二个日期
      end - 结束日期
      返回:
      是否
    • isToday

      public static boolean isToday(Date date)
      查看是否是今天。
      参数:
      date - 日期
      返回:
      是否
    • getDate

      public static Date getDate(Date date1, long interval)
      获取一个时间加一个时间间隔(毫秒)后的时间。
      参数:
      date1 - 日期
      interval - 间隔
      返回:
      结果
    • getDate

      public static Date getDate(Date date, double interval)
      获取一个时间加一个时间间隔(天)后的时间。
      参数:
      date - 日期
      interval - 间隔
      返回:
      结果
    • getYesterday

      public static Date getYesterday()
      返回昨天
      返回:
      日期
    • getTomorrow

      public static Date getTomorrow()
      取得明天。
      返回:
      明天
    • getDate

      public static Date getDate(String dateStr)
    • getTime

      public static Date getTime(String timeStr) throws ParseException
      抛出:
      ParseException
    • getTimestamp

      public static Date getTimestamp(String timeStr) throws ParseException
      抛出:
      ParseException
    • getDate

      public static Date getDate(String dateStr, String format) throws ParseException
      抛出:
      ParseException
    • getInterval

      public static long getInterval(Date date1, Date date2)
      取两个时间的时间差。
      参数:
      date1 - 日期1
      date2 - 日期2
      返回:
      间隔