类 DateSupport
java.lang.Object
gu.sql2java.utils.DateSupport
日期工具类
- 从以下版本开始:
- 3.29.2
- 作者:
- guyadong
-
字段概要
字段 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static <F,T> T castToDate(F from, Class<T> targetClass) 将对象转为指定的日期类型static StringformatDate(Date date, String format) formatDateto stringstatic DategetDateFromString(String strDate) get a date from a date string representation in one of the registered formatsstatic DategetDateFromString(String strDate, AtomicReference<String> pattern, int... excludeIndexs) get a date from a date string representation in one of the registered formatsstatic booleanVerify that the string represantes the date with one of the registered formatsstatic <D> DparseAsDate(String input, Class<D> targetClass, int... excludeIndexs) get a date from a date string representation in one of the registered formatsstatic <D extends Date>
DparseDateString(String dateStr, Class<D> targetClass) get a date from a date string representation in one of the registered formatsstatic StringVerify that the string represantes the date with one of the registered formatsstatic StringtoISO8601String(Date date) convertDateto ISO8601 date time format string
-
字段详细资料
-
TIMESTAMP_FORMATTER_STR
用于SQL语句的时间戳格式转换格式
-
-
构造器详细资料
-
DateSupport
public DateSupport()
-
-
方法详细资料
-
getDateFromString
public static Date getDateFromString(String strDate, AtomicReference<String> pattern, int... excludeIndexs) get a date from a date string representation in one of the registered formats- 参数:
strDate- the date as string.pattern- [out] if not null, return pattern string or null if (null or empty) or correct pattern was not foundexcludeIndexs- excluded pattern index- 返回:
- Date object ,otherwise null If (null or empty) or correct pattern was not found
-
getDateFromString
get a date from a date string representation in one of the registered formats- 参数:
strDate- the date as string.- 返回:
- Date object ,otherwise null If (null or empty) or correct pattern was not found
-
parseDateString
get a date from a date string representation in one of the registered formats- 参数:
dateStr- the date as string.targetClass-- 返回:
- Date object ,otherwise null If (null or empty) or correct pattern was not found
-
parseAsDate
get a date from a date string representation in one of the registered formats- 参数:
input- the date as string.targetClass- Date or Calendar or subclass requiredexcludeIndexs- excluded pattern index- 返回:
- Date object ,otherwise null If (null or empty) or correct pattern was not found
-
toISO8601String
convertDateto ISO8601 date time format string- 参数:
date-- 返回:
- ISO8601 date time format string or null if date is null
-
formatDate
formatDateto string- 参数:
date-format- date time format string,use ISO8601 format if null- 返回:
- ISO8601 date time format string or null if date is null
-
isDate
Verify that the string represantes the date with one of the registered formats- 参数:
strDate- the date as string.- 返回:
- boolean "true" if the string represantes the date in one of the registed formats.
-
patternOf
Verify that the string represantes the date with one of the registered formats- 参数:
strDate- the date as string.- 返回:
- boolean "true" if the string represantes the date in one of the registed formats.
- 从以下版本开始:
- 3.25.0
-
castToDate
将对象转为指定的日期类型- 类型参数:
F- 原类型 String,Number,java.util.Date or Calendar or subclassT- 目标类型 java.util.Date or Calendar or subclass- 参数:
from-targetClass-
-