public class DateUtil extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
static String |
COMPACT_DATE_PATTERN |
static String |
COMPACT_DATETIME_PATTERN |
static String |
COMPACT_TRIM_SECOND_PATTERN |
static String |
DATE_PATTERN |
static String |
DATETIME_PATTERN |
static long |
MILLIS_PER_DAY
24×60×60×1000
|
static long |
MILLIS_PER_HOUR
60×60×1000
|
static long |
MILLIS_PER_MINUTE
60×1000
|
static long |
MILLIS_PER_SECOND
1000
|
static String |
SLASH_DATE_PATTERN |
static String |
SLASH_DATETIME_PATTERN |
static String |
SLASH_TRIM_SECOND_PATTERN |
static long |
TIME_DIFF |
static String |
TRIM_SECOND_PATTERN |
| 构造器和说明 |
|---|
DateUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static Date |
addDay(Date date,
int amount) |
static Date |
addMilliSecond(Date date,
int amount) |
static Date |
addMinute(Date date,
int amount) |
static Date |
addMonth(Date date,
int amount) |
static Date |
addSecond(Date date,
int amount) |
static Date |
currentDate() |
static Long |
currentTime() |
static int |
dayInMonth(Date date) |
static int |
dayInWeek(Date date) |
static int |
dayInWeekForUse(Date date) |
static Date |
dayOfBegin(Date date) |
static Date |
dayOfEnd(Date date) |
static String |
format(Calendar c,
String pattern) |
static String |
format(Date date) |
static String |
format(Date date,
String pattern) |
static int |
getMonth(Date date) |
static String |
getPattern(String strDate) |
static int |
getYear(Date date) |
static boolean |
isDate(String strDate) |
static boolean |
isSameDay(Date date,
Date other) |
static boolean |
oneDayAgo(Date date) |
static boolean |
oneHourAgo(Date date) |
static Date |
parse(Long date) |
static Date |
parse(String strDate) |
static Date |
parse(String strDate,
String pattern) |
static Calendar |
parseCalendar(String dateStr,
String pattern) |
static long |
reduce(Date startDate,
Date endDate,
long timeType) |
static Date |
setDay(Date date,
int amount) |
static Date |
setMonth(Date date,
int amount) |
static Date |
setYear(Date date,
int amount) |
public static long TIME_DIFF
public static final long MILLIS_PER_SECOND
public static final long MILLIS_PER_MINUTE
public static final long MILLIS_PER_HOUR
public static final long MILLIS_PER_DAY
public static Date currentDate()
public static Long currentTime()
public static boolean isDate(String strDate)
strDate判断是不是日期格式 - public static boolean oneDayAgo(Date date)
public static boolean oneHourAgo(Date date)
public static int dayInWeek(Date date)
date - public static int dayInWeekForUse(Date date)
date - public static int dayInMonth(Date date)
public static int getYear(Date date)
public static int getMonth(Date date)
Copyright © 2019. All rights reserved.