public class DateUtil extends Object
| 构造器 | 说明 |
|---|---|
DateUtil() |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
static Date |
addDays(Date sDate,
float days) |
Add days to a date
|
static int |
dayOfYear(int year,
int month,
int day) |
Get day of year
|
static Date |
doy2date(int year,
int doy) |
Convert day of year to date
|
static boolean |
equals(Date a,
Date b) |
Date equals
|
static Date |
fromOADate(double oaDate) |
Convert OA date to date
|
static String |
getDateFormat(org.joda.time.ReadablePeriod p) |
Get date format string
|
static org.joda.time.DateTime |
getDateTime(String dts) |
Get date time from string
|
static org.joda.time.DateTime |
getDateTime_(String dts) |
Get date time from string
|
static List<org.joda.time.DateTime> |
getDateTimes(int tNum,
org.joda.time.DateTime end,
org.joda.time.ReadablePeriod p) |
Get date time list
|
static List<org.joda.time.DateTime> |
getDateTimes(org.joda.time.DateTime start,
int tNum,
org.joda.time.ReadablePeriod p) |
Get date time list
|
static List<org.joda.time.DateTime> |
getDateTimes(org.joda.time.DateTime start,
org.joda.time.DateTime end,
org.joda.time.ReadablePeriod p) |
Get date time list
|
static int |
getDays(Date t,
Date baseDate) |
Get days difference between two dates
|
static int |
getDaysInMonth(int year,
int month) |
Get days of a month
|
static int |
getHours(Date t,
Date baseDate) |
Get hours difference between two dates
|
static org.joda.time.ReadablePeriod |
getPeriod(String pStr) |
Get period from string
|
static org.joda.time.PeriodType |
getPeriodType(String p) |
Get period type from string
|
static int |
getTimeDeltaValue(Date t,
Date baseDate,
String tDelta) |
Get time value - Time delta value of base date
|
static List<Integer> |
getTimeDeltaValues(List<Date> times,
Date baseDate,
String tDelta) |
Get time values - Time delta values of base date
|
static double |
toOADate(Date date) |
Convert date to OA date
|
public static Date addDays(Date sDate, float days)
sDate - Start datedays - Dayspublic static int getDaysInMonth(int year,
int month)
year - The yearmonth - The monthpublic static List<Integer> getTimeDeltaValues(List<Date> times, Date baseDate, String tDelta)
times - Time listbaseDate - Base datetDelta - Time delta type - days/hours/...public static int getTimeDeltaValue(Date t, Date baseDate, String tDelta)
t - The timebaseDate - Base datetDelta - Time delta type - days/hours/...public static int getDays(Date t, Date baseDate)
t - The timebaseDate - Base datepublic static int getHours(Date t, Date baseDate)
t - The timebaseDate - Base datepublic static Date fromOADate(double oaDate)
oaDate - OA datepublic static double toOADate(Date date)
date - Datepublic static boolean equals(Date a, Date b)
a - Date ab - Date bpublic static int dayOfYear(int year,
int month,
int day)
year - Yearmonth - Monthday - Daypublic static Date doy2date(int year, int doy)
year - Yeardoy - Day of yearpublic static org.joda.time.PeriodType getPeriodType(String p)
p - Period type stringpublic static org.joda.time.ReadablePeriod getPeriod(String pStr)
pStr - Period stringpublic static String getDateFormat(org.joda.time.ReadablePeriod p)
p - Periodpublic static org.joda.time.DateTime getDateTime(String dts)
dts - Date time stringpublic static org.joda.time.DateTime getDateTime_(String dts)
dts - Date time stringpublic static List<org.joda.time.DateTime> getDateTimes(org.joda.time.DateTime start, org.joda.time.DateTime end, org.joda.time.ReadablePeriod p)
start - Start date timeend - End date timep - Peroidpublic static List<org.joda.time.DateTime> getDateTimes(org.joda.time.DateTime start, int tNum, org.joda.time.ReadablePeriod p)
start - Start date timetNum - Date time numberp - Peroidpublic static List<org.joda.time.DateTime> getDateTimes(int tNum, org.joda.time.DateTime end, org.joda.time.ReadablePeriod p)
end - End date timetNum - Date time numberp - PeroidCopyright © 2019. All rights reserved.