程序包 org.anyline.util
类 DateUtil
java.lang.Object
org.anyline.util.DateUtil
-
字段概要
字段 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static DateaddDay(int value) 按日加static Stringstatic Date按日加, 指定日期static DateaddHour(int value) 按小时加static Datestatic Date按小时加, 指定日期static DateaddMinute(int value) 按分钟加static Datestatic Date按分钟加, 指定日期static DateaddMonth(int value) 按月加static Datestatic Date按月加, 指定日期static DateaddSecond(int value) 按秒加static Date按秒加, 指定日期static DateaddYear(int value) 按年加static Datestatic Date按年加, 指定日期static booleancur是否在fr与to之间(包含fr, to)static booleancur是否在fr与to之间(包含fr, to)static intstatic intdate1 大于 date2返回 1static Stringconversion(double src) static Stringconversion(long src) 毫秒转换成*天*时*分*秒*毫秒static intstatic StringconvertMinute(int minute) 分钟转换成时间static intconvertMinute(String hm) 时间转换成分钟static intstatic intstatic intcountDaysOfMonth(Date date) 一年多少天static intstatic intcountDaysOfYear(int year) static intcountDaysOfYear(Date date) 一年多少天static intday()static intstatic intstatic intdayOfMonth(String date) static intdayOfMonth(Date date) 日(号)static intstatic intstatic int星期几(星期日=0 星期一=1)static intstatic intstatic intstatic longstatic longstatic longstatic long时间差static Stringformat()static Stringformat(long ms) static Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic String格式化日期static Stringstatic Stringstatic Datestatic DategetCurrentWeekday(String date) static DategetCurrentWeekday(Date date) static Stringstatic StringgetCurrentYearEnd(String date) static StringgetCurrentYearEnd(Date date) 本年最后一天的日期static DategetDateOfWeek(int idx) static DategetDateOfWeek(int idx, Date date) 当前日期所在周的第idx天 第1天:星期日 第7天:星期六static intstatic intgetDayOfMonth(String date) static intgetDayOfMonth(Date date) static intstatic intgetDayOfWeek(String date) static intgetDayOfWeek(Date date) 星期几(礼拜几)static intstatic intgetDayOfYear(String date) static intgetDayOfYear(Date date) 区间日期getDaysOfMonth(String ym) getDaysOfMonth(Date ym) getDaysOfWeek(int year, int week) getDaysOfWeek(String date) getDaysOfWeek(Date date) getDaysOfYear(int year) getDaysOfYear(String year) getDaysOfYear(Date date) static Datestatic DategetFirstDayOfMonth(String date) static DategetFirstDayOfMonth(Date date) 当月第一天static Datestatic DategetFirstDayOfNextMonth(String date) static DategetFirstDayOfNextMonth(Date date) 下个月第一天static Datestatic DategetFirstDayOfNextWeek(String date) static DategetFirstDayOfNextWeek(Date date) 下周第一天static Datestatic Datestatic Date上个月第一天static Datestatic Datestatic Date上个周第一天static Datestatic DategetFirstDayOfWeek(String date) static DategetFirstDayOfWeek(Date date) 当周第一天 周日作为一周的第一天static Datestatic DategetFirstDayOfYear(String date) static DategetFirstDayOfYear(Date date) 本年第一天的日期static Datestatic intgetLastDayOfMonth(int year, int month) 获取某年某月的最后一天static DategetLastDayOfMonth(String date) static DategetLastDayOfMonth(Date date) 当月最后一天static Datestatic DategetLastDayOfNextMonth(String date) static DategetLastDayOfNextMonth(Date date) 下月最后一天static Datestatic DategetLastDayOfNextWeek(String date) static DategetLastDayOfNextWeek(Date date) 下周最后天static Datestatic Datestatic Date上月最后一天static Datestatic Datestatic DategetLastDayOfPreviousWeek(Date date) 上个周最后天static Datestatic DategetLastDayOfWeek(String date) static DategetLastDayOfWeek(Date date) 当周最后天static Datestatic DategetMondayOFWeek(String date) static DategetMondayOFWeek(Date date) static intstatic intgetMondayPlus(Date date) static intgetMonthPlus(Date date) 期间的月份static Datestatic DategetNextMonday(String date) static DategetNextMonday(Date date) static Datestatic DategetNextSunday(String date) static DategetNextSunday(Date date) static Datestatic DategetNextYearEnd(String date) static DategetNextYearEnd(Date date) 明年最后一天的日期static Datestatic DategetNextYearFirst(String date) static DategetNextYearFirst(Date date) 明年第一天的日期static Stringstatic StringgetPreviousYearFirst(String date) static StringgetPreviousYearFirst(Date date) 上年第一天的日期static Stringstatic String星期几static intstatic intgetWeekOfYear(Date date) 一年中的第几个星期static inthour()static int小时(点)static booleanisAm()static boolean是上午吗?static booleanstatic booleanisLeapYear(int year) 是否闰年static booleanisPm()static boolean是下午吗?static LocalDatestatic LocalDatestatic LocalDatestatic LocalDatestatic LocalDateTimelocalDateTime(Long timestamp) static LocalDateTimelocalDateTime(Long timestamp, ZoneId zone) static LocalDateTimelocalDateTime(Date date) static LocalDateTimelocalDateTime(Date date, ZoneId zone) static LocalTimestatic LocalTimestatic LocalTimestatic LocalTimestatic Stringstatic Datestatic Stringstatic Datestatic intminute()static int分钟static intmonth()static intstatic int月份static Datenow()现在static OffsetDateTimeoffsetDateTime(Date date) static Datestatic Datestatic Datestatic Date转换成日期(使用默认格式)static Date转换成日期static Datestatic Datestatic Datestatic Datestatic Datestatic Datestatic Dateparse(LocalDateTime value) static Datestatic Dateparse(ZonedDateTime value) static intsecond()static int秒static Datestatic Datestatic Datestatic Timestatic TimestampsqlTimestamp(Date date) static Datetomorrow()明天static intyear()static intstatic int年份static YearMonthstatic Date昨天static ZonedDateTimezonedDateTime(Date date)
-
字段详细资料
-
FORMAT_FULL
- 另请参阅:
-
FORMAT_DATE_TIME
- 另请参阅:
-
FORMAT_DATE
- 另请参阅:
-
FORMAT_TIME
- 另请参阅:
-
DATE_PART_YEAR
public static final int DATE_PART_YEAR- 另请参阅:
-
DATE_PART_MONTH
public static final int DATE_PART_MONTH- 另请参阅:
-
DATE_PART_DATE
public static final int DATE_PART_DATE- 另请参阅:
-
DATE_PART_DAY_OF_YEAR
public static final int DATE_PART_DAY_OF_YEAR- 另请参阅:
-
DATE_PART_HOUR
public static final int DATE_PART_HOUR- 另请参阅:
-
DATE_PART_MINUTE
public static final int DATE_PART_MINUTE- 另请参阅:
-
DATE_PART_SECOND
public static final int DATE_PART_SECOND- 另请参阅:
-
DATE_PART_MILLISECOND
public static final int DATE_PART_MILLISECOND- 另请参阅:
-
-
构造器详细资料
-
DateUtil
public DateUtil()
-
-
方法详细资料
-
between
cur是否在fr与to之间(包含fr, to)- 参数:
cur- 时间fr- 开始时间to- 结束时间- 返回:
- boolean
-
between
cur是否在fr与to之间(包含fr, to)- 参数:
cur- 时间fr- 开始时间to- 结束时间- 返回:
- boolean
-
diff
时间差- 参数:
part- 参考Calendarfr- 开始时间to- 结束时间- 返回:
- long
-
diff
-
diff
-
diff
-
format
格式化日期- 参数:
locale- 地区/语言, 格式化月份, 星期几时根据地区语言, 如MMMMM(zh:一月, en:January)MMMM(zh:一月, en:Jan) EEE(zh:星期五, en:Fri) EEEE(en:Friday)Symbol Meaning Presentation Examples ------ ------- ------------ ------- G era text AD; Anno Domini; A u year year 2005; 04 y year-of-era year 2005; 04 D day-of-year number 189 M/L month-of-year number/text 7; 07; Jul; July; J d day-of-month number 10 g modified-julian-day number 2451334 Q/q quarter-of-year number/text 3; 03; Q3; 3rd quarter Y week-based-year year 1996; 96 w week-of-week-based-year number 27 W week-of-month number 4 E day-of-week text Tue; Tuesday; T e/c localized day-of-week number/text 2; 02; Tue; Tuesday; T F day-of-week-in-month number 3 a am-pm-of-day text PM B period-of-day text in the morning h clock-hour-of-am-pm (1-12) number 12 K hour-of-am-pm (0-11) number 0 k clock-hour-of-day (1-24) number 24 H hour-of-day (0-23) number 0 m minute-of-hour number 30 s second-of-minute number 55 S fraction-of-second fraction 978 A milli-of-day number 1234 n nano-of-second number 987654321 N nano-of-day number 1234000000 V time-zone ID zone-id America/Los_Angeles; Z; -08:30 v generic time-zone name zone-name PT, Pacific Time z time-zone name zone-name Pacific Standard Time; PST O localized zone-offset offset-O GMT+8; GMT+08:00; UTC-08:00; X zone-offset 'Z' for zero offset-X Z; -08; -0830; -08:30; -083015; -08:30:15 x zone-offset offset-x +0000; -08; -0830; -08:30; -083015; -08:30:15 Z zone-offset offset-Z +0000; -0800; -08:00 p pad next pad modifier 1 ' escape for text delimiter '' single quote literal ' [ optional section start ] optional section end # reserved for future use { reserved for future use } reserved for future usedate- 日期format- 格式- 返回:
- String
-
format
-
format
-
format
-
format
-
format
-
format
-
format
-
format
-
format
-
format
-
format
-
format
-
format
-
format
-
format
-
format
-
format
-
format
-
format
-
format
-
convertMinute
时间转换成分钟- 参数:
hm- 时间(10:10=610)- 返回:
- int
-
convertMinute
public static int convertMinute() -
convertMinute
分钟转换成时间- 参数:
minute- 分钟(610=10:10)- 返回:
- String
-
getWeek
星期几- 参数:
date- 日期- 返回:
- String
-
getWeek
-
getFirstDayOfWeek
当周第一天 周日作为一周的第一天- 参数:
date- 日期- 返回:
- Date
-
getFirstDayOfWeek
-
getFirstDayOfWeek
-
getFirstDayOfNextWeek
下周第一天- 参数:
date- 日期- 返回:
- Date
-
getFirstDayOfNextWeek
-
getFirstDayOfNextWeek
-
getFirstDayOfPreviousWeek
上个周第一天- 参数:
date- 日期- 返回:
- Date
-
getFirstDayOfPreviousWeek
-
getFirstDayOfPreviousWeek
-
getLastDayOfWeek
当周最后天- 参数:
date- 日期- 返回:
- Date
-
getLastDayOfWeek
-
getLastDayOfWeek
-
getLastDayOfNextWeek
下周最后天- 参数:
date- 日期- 返回:
- Date
-
getLastDayOfNextWeek
-
getLastDayOfNextWeek
-
getLastDayOfPreviousWeek
上个周最后天- 参数:
date- 日期- 返回:
- Date
-
getLastDayOfPreviousWeek
-
getLastDayOfPreviousWeek
-
getFirstDayOfMonth
当月第一天- 参数:
date- 日期- 返回:
- Date
-
getFirstDayOfMonth
-
getFirstDayOfMonth
-
getFirstDayOfNextMonth
下个月第一天- 参数:
date- 日期- 返回:
- Date
-
getFirstDayOfNextMonth
-
getFirstDayOfNextMonth
-
getFirstDayOfPreviousMonth
上个月第一天- 参数:
date- 日期- 返回:
- Date
-
getFirstDayOfPreviousMonth
-
getFirstDayOfPreviousMonth
-
getLastDayOfMonth
当月最后一天- 参数:
date- 日期- 返回:
- Date
-
getLastDayOfMonth
-
getLastDayOfMonth
-
getLastDayOfPreviousMonth
上月最后一天- 参数:
date- 日期- 返回:
- Date
-
getLastDayOfPreviousMonth
-
getLastDayOfPreviousMonth
-
getLastDayOfNextMonth
下月最后一天- 参数:
date- 日期- 返回:
- Date
-
getLastDayOfNextMonth
-
getLastDayOfNextMonth
-
getCurrentWeekday
-
getCurrentWeekday
-
getCurrentWeekday
-
getMondayPlus
-
getMondayPlus
public static int getMondayPlus() -
getMondayOFWeek
-
getMondayOFWeek
-
getMondayOFWeek
-
getNextMonday
-
getNextMonday
-
getNextMonday
-
getNextSunday
-
getNextSunday
-
getNextSunday
-
getMonthPlus
-
getNextYearEnd
明年最后一天的日期- 参数:
date- 日期- 返回:
- Date
-
getNextYearEnd
-
getNextYearEnd
-
getNextYearFirst
明年第一天的日期- 参数:
date- 日期- 返回:
- Date
-
getNextYearFirst
-
getNextYearFirst
-
countDaysOfYear
一年多少天- 参数:
date- date- 返回:
- int
-
countDaysOfYear
public static int countDaysOfYear(int year) -
countDaysOfYear
public static int countDaysOfYear() -
countDaysOfMonth
一年多少天- 参数:
date- date- 返回:
- int
-
countDaysOfMonth
-
countDaysOfMonth
public static int countDaysOfMonth() -
getFirstDayOfYear
本年第一天的日期- 参数:
date- 日期- 返回:
- Date
-
getFirstDayOfYear
-
getFirstDayOfYear
-
getCurrentYearEnd
本年最后一天的日期- 参数:
date- 日期- 返回:
- String
-
getCurrentYearEnd
-
getCurrentYearEnd
-
getPreviousYearFirst
上年第一天的日期- 参数:
date- 日期- 返回:
- String
-
getPreviousYearFirst
-
getPreviousYearFirst
-
getLastDayOfMonth
public static int getLastDayOfMonth(int year, int month) 获取某年某月的最后一天- 参数:
year- 年month- 月- 返回:
- 最后一天
-
isLeapYear
public static boolean isLeapYear(int year) 是否闰年- 参数:
year- 年- 返回:
- boolean
-
parse
转换成日期- 参数:
date- 日期format- format- 返回:
- Date
- 抛出:
RuntimeException
-
parse
-
parse
-
parse
-
parse
-
parse
-
parse
-
parse
-
parse
-
parse
-
parse
- 抛出:
RuntimeException
-
parse
-
parse
-
parse
转换成日期(使用默认格式)- 参数:
value- 日期- 返回:
- Date
- 抛出:
RuntimeException
-
isDate
-
yesterday
昨天- 返回:
- Date
-
tomorrow
明天- 返回:
- Date
-
now
现在- 返回:
- Date
-
addDay
按日加- 参数:
value- 天数- 返回:
- Date
-
addDay
按日加, 指定日期- 参数:
date- 日期value- 天数- 返回:
- Date
-
addDay
-
addMonth
按月加- 参数:
value- 月数- 返回:
- Date
-
addMonth
按月加, 指定日期- 参数:
date- 日期value- 月数- 返回:
- Date
-
addMonth
-
addYear
按年加- 参数:
value- 年数- 返回:
- Date
-
getDateOfWeek
当前日期所在周的第idx天 第1天:星期日 第7天:星期六- 参数:
idx- idxdate- 日期- 返回:
- Date
-
getDateOfWeek
-
getDayOfWeek
星期几(礼拜几)- 参数:
date- date- 返回:
- int
-
getDayOfWeek
public static int getDayOfWeek() -
getDayOfWeek
-
getDays
区间日期- 参数:
fr- frto- to- 返回:
- List
-
getMonths
期间的月份- 参数:
fr- yyyy-MM 或 yyyy-MM-ddto- yyyy-MM 或 yyyy-MM-dd- 返回:
- List
-
getDaysOfYear
-
getDaysOfYear
-
getDaysOfYear
-
getDaysOfMonth
-
getDaysOfMonth
-
getDaysOfWeek
-
getDaysOfWeek
-
getDaysOfWeek
-
getDays
-
max
-
min
-
max
-
min
-
getWeekOfYear
一年中的第几个星期- 参数:
date- date- 返回:
- int
-
getWeekOfYear
public static int getWeekOfYear() -
addYear
按年加, 指定日期- 参数:
date- 日期value- value- 返回:
- Date
-
addYear
-
addHour
按小时加- 参数:
value- value- 返回:
- Date
-
addHour
按小时加, 指定日期- 参数:
date- 日期value- value- 返回:
- Date
-
addHour
-
addMinute
按分钟加- 参数:
value- value- 返回:
- Date
-
addSecond
按秒加- 参数:
value- value- 返回:
- Date
-
addMinute
按分钟加, 指定日期- 参数:
date- 日期value- value- 返回:
- Date
-
addSecond
按秒加, 指定日期- 参数:
date- 日期value- value- 返回:
- Date
-
addMinute
-
year
年份- 参数:
date- date- 返回:
- int
-
year
public static int year() -
year
-
month
月份- 参数:
date- date- 返回:
- int
-
month
-
month
public static int month() -
dayOfWeek
星期几(星期日=0 星期一=1)- 参数:
date- date- 返回:
- int
-
dayOfWeek
public static int dayOfWeek() -
dayOfWeek
-
dayOfMonth
日(号)- 参数:
date- date- 返回:
- int
-
dayOfMonth
-
dayOfMonth
public static int dayOfMonth() -
getDayOfMonth
-
getDayOfMonth
-
getDayOfMonth
public static int getDayOfMonth() -
day
-
day
public static int day() -
dayOfYear
-
dayOfYear
-
dayOfYear
public static int dayOfYear() -
getDayOfYear
-
getDayOfYear
-
getDayOfYear
public static int getDayOfYear() -
hour
小时(点)- 参数:
date- date- 返回:
- int
-
hour
public static int hour() -
minute
分钟- 参数:
date- date- 返回:
- int
-
minute
public static int minute() -
second
秒- 参数:
date- date- 返回:
- int
-
second
public static int second() -
compare
date1 大于 date2返回 1- 参数:
date1- date2date2- date2- 返回:
- int
-
compare
-
isAm
是上午吗?- 参数:
date- date- 返回:
- boolean
-
isAm
public static boolean isAm() -
isPm
是下午吗?- 参数:
date- date- 返回:
- boolean
-
isPm
public static boolean isPm() -
conversion
-
conversion
毫秒转换成*天*时*分*秒*毫秒- 参数:
src- 毫秒- 返回:
- String
-
localDateTime
-
offsetDateTime
-
localDateTime
-
zonedDateTime
-
localTime
-
localTime
-
localDate
-
localDate
-
localDateTime
-
localDateTime
-
localTime
-
localTime
-
localDate
-
localDate
-
sqlDate
-
sqlDate
-
sqlTime
-
sqlTimestamp
-
sqlDate
-
yearMonth
-
format
-