|
com.Ostermiller.util Java Utilities |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.Ostermiller.util.DateTimeParse
public class DateTimeParse
Parses a variety of formatted date strings with minimal configuration. Unlike other date parsers, there are no formats to specify. There is a single parse string method.
A wide variety of formats are supported:
Nested Class Summary | |
---|---|
static class |
DateTimeParse.Field
|
Constructor Summary | |
---|---|
DateTimeParse()
|
|
DateTimeParse(Locale locale)
|
Method Summary | |
---|---|
List<DateTimeParse.Field> |
getFieldOrder()
|
Date |
parse(String dateString)
Parse the given string into a Date. |
void |
setDefaultYear(int defaultYear)
Set the default year to use when there is no year in the parsed date. |
void |
setFieldOrder(DateTimeParse.Field[] fieldOrder)
|
void |
setFieldOrder(List<DateTimeParse.Field> fieldOrder)
|
DateTimeParse |
setTimeZone(TimeZone zone)
|
DateTimeParse |
setYearExtensionPolicy(YearExtensionPolicy yearExtensionPolicy)
Set the year extension policy. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DateTimeParse()
public DateTimeParse(Locale locale)
Method Detail |
---|
public void setFieldOrder(List<DateTimeParse.Field> fieldOrder)
public void setFieldOrder(DateTimeParse.Field[] fieldOrder)
public List<DateTimeParse.Field> getFieldOrder()
public void setDefaultYear(int defaultYear)
public DateTimeParse setYearExtensionPolicy(YearExtensionPolicy yearExtensionPolicy)
The default policy is YearExtensionAround.NEAREST
. Several other
policies are implemented:
public Date parse(String dateString)
dateString
- String with a date representation.
public DateTimeParse setTimeZone(TimeZone zone)
|
com.Ostermiller.util Java Utilities |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 2001-2012 by Stephen Ostermiller