public final class DateUtil extends Object
| 限定符和类型 | 类和说明 |
|---|---|
static interface |
DateUtil.DATE_PATTERN
日期格式
|
| 限定符和类型 | 方法和说明 |
|---|---|
static Date |
addDate(Date date,
int field,
int amount)
日期计算
|
static String |
format(Object date)
格式化日期
|
static String |
format(Object date,
String pattern)
格式化日期
|
static String |
getDate()
获取日期
|
static String |
getDateTime()
获取日期时间
|
static String |
getDateTime(String pattern)
获取日期
|
static Integer |
getDayBetween(Date startDate,
Date endDate)
间隔天数
|
static Integer |
getMonthBetween(Date startDate,
Date endDate)
间隔月
|
static Integer |
getMonthBetweenWithDay(Date startDate,
Date endDate)
间隔月,多一天就多算一个月
|
static Date |
stringToDate(String date)
字符串转换为日期:不支持yyM[M]d[d]格式
|
public static final String format(Object date, String pattern)
date - pattern - public static final String getDate()
public static final String getDateTime()
public static final Date addDate(Date date, int field, int amount)
date - field - amount - public static final Date stringToDate(String date)
date - public static final Integer getDayBetween(Date startDate, Date endDate)
startDate - endDate - public static final Integer getMonthBetween(Date startDate, Date endDate)
startDate - endDate - Copyright © 2017. All rights reserved.