Package com.redwood.scheduler.api.date
Class DateFormatter
- java.lang.Object
-
- com.redwood.scheduler.api.date.DateFormatter
-
public class DateFormatter extends Object
Formatter that extends Java's SimpleDateFormat. Extensions:- Locale support using the syntax "{<locale>}" eg. "{nl}"
- Place holder for parsing Time Zone ID "i"
-
-
Field Summary
Fields Modifier and Type Field Description protected static String
TZGENERAL_FIELD
protected static String
TZID_FIELD
-
Constructor Summary
Constructors Constructor Description DateFormatter(String newFormat, Locale newLocale)
Extended SimpleDateFormatting
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
format(DateTimeZone value)
DateTimeZone
parse(String value)
DateTimeZone
parse(TimeZone timeZone, String value)
String
toLocalizedPattern()
String
toPattern()
-
-
-
Field Detail
-
TZID_FIELD
protected static final String TZID_FIELD
- See Also:
- Constant Field Values
-
TZGENERAL_FIELD
protected static final String TZGENERAL_FIELD
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DateFormatter
public DateFormatter(String newFormat, Locale newLocale)
Extended SimpleDateFormatting- Parameters:
newFormat
-newLocale
-- Throws:
com.redwood.scheduler.api.exception.InvalidFormatException
- if the given format is nullIllegalArgumentException
- if the given format is invalidcom.redwood.scheduler.api.exception.InvalidDateFormatUnknownLocale
- if the given format contains a unknown locale id
-
-
Method Detail
-
format
public String format(DateTimeZone value)
- Parameters:
value
-- Returns:
- String
- Throws:
IllegalArgumentException
- if the given format is invalid
-
parse
public DateTimeZone parse(String value) throws ParseException
- Parameters:
value
-- Returns:
- DateTimeZone
- Throws:
ParseException
- if the value can not be parsedIllegalArgumentException
- if the given format is invalid
-
parse
public DateTimeZone parse(TimeZone timeZone, String value) throws ParseException
- Parameters:
timeZone
-value
-- Returns:
- DateTimeZone
- Throws:
ParseException
- if the value can not be parsedIllegalArgumentException
- if the given format is invalid
-
toLocalizedPattern
public String toLocalizedPattern()
-
toPattern
public String toPattern()
-
-