Class DateUtils
java.lang.Object
org.nutz.lang.Times
tech.riemann.nif.utils.DateUtils
public class DateUtils
extends org.nutz.lang.Times
日期工具类,扩展自Times类,提供各种日期处理方法
- Author:
- Kerbores(kerbores@riemann.tech)
-
Nested Class Summary
Nested classes/interfaces inherited from class org.nutz.lang.Times
org.nutz.lang.Times.TmInfo -
Field Summary
FieldsFields inherited from class org.nutz.lang.Times
T_1D, T_1H, T_1M, T_1MS, T_1S, T_1W -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic DateaddDays(int days) 从今日开始的日期加减static Date日期加减static DateaddSeconds(long seconds) 增加秒static DateaddSeconds(Date base, long seconds) 增加秒static doubledaysBetween(Date start, Date end) 两个日期之间的天数差static Date获取今日结束时间static Date获取当日结束时间static int获取当前月份的天数static Date获取今日凌晨static DategetDayStart(Date d) 获取当日凌晨static Date获取月末日期static DategetMonthEnd(Date d) 获取月末日期static String获取当前月份的结束日期static StringgetMonthEndDate(Date date) 获取指定日期所在月份的结束日期static Date获取月初日期static Date获取月初日期static String获取当前月份的开始日期static StringgetMonthStartDate(Date date) 获取指定日期所在月份的开始日期static String获取时间相关序列static DategetWeekEnd(boolean startFromSunday) 获取当前日期的周结束(周日或者周六)static DategetWeekEnd(boolean startFromSunday, Date date) 获取指定日期的周结束(周日或者周六)static DategetWeekStart(boolean startFromSunday) 获取当前日期的周开始(周一或者周日)static DategetWeekStart(boolean startFromSunday, Date date) 获取指定日期的周开始(周一或者周日)static Date获取年末日期static DategetYearEnd(Date d) 获取年末日期static String获取当前年份的结束月份static StringgetYearEndMonth(Date date) 获取指定日期所在年份的结束月份static Date获取元旦日期static DategetYearStart(Date d) 获取元旦日期static String获取当前年份的开始月份static StringgetYearStartMonth(Date date) 获取指定日期所在年份的开始月份Methods inherited from class org.nutz.lang.Times
afterDay, ams, ams, befoDay, between, C, C, C, countLeapYear, D, D, D1970, d2TS, dayDiff, dayDiffCurr, format, format, formatForRead, fromMillis, fromMillisCN, getAstro, getDateByNum, getDay, getDayNum, getDaysOfMonth, getDaysOfMonth, getFirstDayOfMonth, getLastDayOfMonth, getMonth, getNowSDT, getToday, getToMonth, getToYear, getTS, getYear, isDate, leapYear, ms, ms, ms, ms, ms, mss, nextDay, nextDay, nextHour, nextMinute, nextMonth, nextSecond, nextWeek, nextYear, now, parse, parse, parseq, parseq, sD, sDT, sDT2TS, sDTcompare, sDTms, sDTms2, sDTms4, sec, sec, secs, sT, sTmin, sTms, T, T, Ti, Ti, Tims, toMillis, ts2D, ts2S, week, week, weeks, weeks, yearDiff, yearDiffCurr
-
Field Details
-
DATE_FORMAT_MONTH
- See Also:
-
DATE_FORMAT_DAY
- See Also:
-
-
Constructor Details
-
DateUtils
public DateUtils()
-
-
Method Details
-
addDays
-
addDays
从今日开始的日期加减- Parameters:
days- 增加天数 正数为之后日期负数为之前日期- Returns:
- 目标日期
-
daysBetween
-
getDayStart
-
getDayEnd
-
getDayStart
-
getDayEnd
-
getWeekEnd
获取当前日期的周结束(周日或者周六)- Parameters:
startFromSunday- 从周日开始计算周 标识- Returns:
- startFromSunday 为true 则返回下一个周六 为false则返回下一个周日
-
getWeekEnd
-
getWeekStart
获取当前日期的周开始(周一或者周日)- Parameters:
startFromSunday- 从周日开始计算周 标识- Returns:
- startFromSunday 为true 则返回上一个周日 为false则返回上一个周一
-
getWeekStart
-
addSeconds
-
addSeconds
-
getYearStart
-
getYearStart
-
getYearEnd
-
getYearEnd
-
getMonthStart
-
getMonthStart
-
getMonthEnd
-
getMonthEnd
-
getSequence
-
getYearStartMonth
-
getYearStartMonth
-
getYearEndMonth
-
getYearEndMonth
-
getMonthStartDate
-
getMonthStartDate
-
getMonthEndDate
-
getMonthEndDate
-
getDayOfMonth
public static int getDayOfMonth()获取当前月份的天数- Returns:
- 当前月份的天数
-