public final class DateParserUtils extends Object
DateParser.| 限定符和类型 | 方法和说明 |
|---|---|
static Calendar |
parseCalendar(String str)
Parse the specified String into Calendar instance, it will convert different TimeZone into system's default zone.
|
static Date |
parseDate(String str)
Parse the specified String into Date instance, it will convert different TimeZone into system's default zone.
|
static LocalDateTime |
parseDateTime(String str)
Parse the specified String into LocalDateTime, it will convert different TimeZone into system's default zone.
|
static OffsetDateTime |
parseOffsetDateTime(String str)
Parse the specified String into OffsetDateTime, use +00:00 as default ZoneOffset.
|
static void |
preferMonthFirst(boolean preferMonthFirst)
Setup the current Utils prefer mm/dd or not.
|
static void |
registerCustomizedRule(String re,
RuleHandler handler)
Register new customized parse rules.
|
static void |
registerStandardRule(String re)
Register new standard parse rules, all captured group should have the specified names.
|
public static Date parseDate(String str)
str - Datetime string like '2019-10-01 00:10:20 +0800'public static Calendar parseCalendar(String str)
str - Datetime string like '2019-10-01 00:10:20 +0800'public static LocalDateTime parseDateTime(String str)
str - Datetime string like '2019-10-01 +08:00'public static OffsetDateTime parseOffsetDateTime(String str)
str - Datetime string like '2019-10-01'public static void preferMonthFirst(boolean preferMonthFirst)
preferMonthFirst - Prefer dd/mm or mm/ddpublic static void registerStandardRule(String re)
re - The regex of rulepublic static void registerCustomizedRule(String re, RuleHandler handler)
re - The regex of rule, like '\d{8}'handler - The handler for this ruleCopyright © 2019. All rights reserved.