public class DateUtils
extends org.apache.commons.lang.time.DateUtils
| 限定符和类型 | 字段和说明 |
|---|---|
static SimpleDateFormat |
DATE_FMT |
static String |
DATE_FMT_STR |
static String |
DATETIME_FMT_STR |
MILLIS_IN_DAY, MILLIS_IN_HOUR, MILLIS_IN_MINUTE, MILLIS_IN_SECOND, MILLIS_PER_DAY, MILLIS_PER_HOUR, MILLIS_PER_MINUTE, MILLIS_PER_SECOND, RANGE_MONTH_MONDAY, RANGE_MONTH_SUNDAY, RANGE_WEEK_CENTER, RANGE_WEEK_MONDAY, RANGE_WEEK_RELATIVE, RANGE_WEEK_SUNDAY, SEMI_MONTH, UTC_TIME_ZONE| 构造器和说明 |
|---|
DateUtils() |
| 限定符和类型 | 方法和说明 |
|---|---|
static Date |
add(Date date,
int field,
int amount)
给指定时间 指定的field增加指定的值
|
static Date |
add(int field,
int amount)
给当前时间 指定的field增加指定的值
|
static int |
addAndCompare(Date date,
Date compared,
int field,
int amount)
给指定时间 指定的field增加指定的值 与compared比较
|
static int |
addAndCompare(Date compared,
int field,
int amount)
给当前时间 指定的field增加指定的值 与compared比较
|
static Date |
addDate(Date date,
int field,
int amount) |
static String |
format(Date d) |
static String |
format(Date d,
String formater) |
static Date |
format2Date(Date d,
String formater) |
static Date[] |
getCurrentDayRange()
返回当天开始和结束的时间
如:当前时间为 2013-07-09 15:33:50 将返回
|
static Date |
getDateByms(long time) |
static Date |
getDayEnd(Date d)
获取传入日期的截止时间
示例:2013-09-23 23:59:59
|
static Date[] |
getDayRange(Date date)
返回指定日期的开始和结束时间
date为 2013-07-09 15:33:50 将返回
|
static Date[] |
getDayRange(Date begin,
Date end)
获取指定日期的时间范围
|
static Date |
getDayStart(Date d)
获取传入日期的起始时间
示例:2013-09-23 00:00:00
|
static Date[] |
getMondayAndSundayByDate(Date date)
通过日期获取这日期所在周的周1和周日时间
|
static Date |
getMonthEnd() |
static Date |
getMonthStart()
获取本月第一天
|
static Date |
getWeekEnd()
功能:获取本周的结束时间
示例:2013-05-19 23:59:59
|
static Date |
getWeekStart()
功能:获取本周的开始时间
示例:2013-05-13 00:00:00
|
static void |
main(String[] args) |
static Date |
parse(String date) |
static Date |
parse(String date,
String formater) |
static Calendar |
parse2Calenar(String date) |
static Calendar |
parse2Calenar(String date,
String formater) |
static Date |
scrableDate(Date date,
Date time)
把日期和时间 拼成一个完整的日期
|
static Date[] |
surplusDayOfMonth()
返回当前的月份剩余的日期(包含今天)
example: 今天2013-04-09 则返回[2013-04-09,2013-04-30]
|
addDays, addHours, addMilliseconds, addMinutes, addMonths, addSeconds, addWeeks, addYears, ceiling, ceiling, ceiling, getFragmentInDays, getFragmentInDays, getFragmentInHours, getFragmentInHours, getFragmentInMilliseconds, getFragmentInMilliseconds, getFragmentInMinutes, getFragmentInMinutes, getFragmentInSeconds, getFragmentInSeconds, isSameDay, isSameDay, isSameInstant, isSameInstant, isSameLocalTime, iterator, iterator, iterator, parseDate, parseDateStrictly, round, round, round, setDays, setHours, setMilliseconds, setMinutes, setMonths, setSeconds, setYears, toCalendar, truncate, truncate, truncate, truncatedCompareTo, truncatedCompareTo, truncatedEquals, truncatedEqualspublic static final SimpleDateFormat DATE_FMT
public static Date[] surplusDayOfMonth()
public static Date[] getCurrentDayRange()
public static Date[] getDayRange(Date date)
public static Date[] getDayRange(Date begin, Date end)
begin - 2013-07-09 15:33:50end - 2013-07-12 15:33:50public static Date scrableDate(Date date, Date time)
date - 日期time - 时间public static Date add(Date date, int field, int amount)
field - Calendar.fieldamount - 正数或者负数public static Date add(int field, int amount)
field - Calendar.fieldamount - 正数或者负数public static int addAndCompare(Date compared, int field, int amount)
compared - 被比较的日期field - Calendar.fieldamount - 正数或者负数public static int addAndCompare(Date date, Date compared, int field, int amount)
date - date对象add指定field的amount值compared - 被比较的日期field - Calendar.fieldamount - 正数或者负数public static Date getWeekStart()
public static Date getWeekEnd()
public static Date getMonthStart()
public static Date getMonthEnd()
public static void main(String[] args)
public static Date[] getMondayAndSundayByDate(Date date)
date - public static Date getDateByms(long time)
Copyright © 2016. All rights reserved.