Package org.eclipse.birt.core.format
Class DateFormatter
java.lang.Object
org.eclipse.birt.core.format.DateFormatter
- All Implemented Interfaces:
IFormatter
DateFormatter.
Design for Class DateFormatter.This version is for open source, so we only
apply the function which Java has provided. Beside these basic function, in
this version, we also provide some new API for further implementation in the
future
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.eclipse.birt.core.format.IFormatter
IFormatter.DefaultFormatter
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstructor method with no parameterDateFormatter
(com.ibm.icu.util.TimeZone timeZone) ConstructorDateFormatter
(com.ibm.icu.util.ULocale localeLoc) Constructor method with Locale parametersDateFormatter
(com.ibm.icu.util.ULocale localeLoc, com.ibm.icu.util.TimeZone timeZone) ConstructorDateFormatter
(String pattern) Constructor method with String parameterDateFormatter
(String pattern, com.ibm.icu.util.ULocale localeLoc) Constructor method with two parameters, one is String type while the other is Locale typeDateFormatter
(String pattern, com.ibm.icu.util.ULocale localeLoc, com.ibm.icu.util.TimeZone timeZone) Constructor -
Method Summary
Modifier and TypeMethodDescriptionvoid
applyPattern
(String formatString) Method to set the date/time format stringtransfer the format string pattern from msdn to the string pattern which java can recognizeformatValue
(Object value) format the value object into a string.Method to return format code according to format type and current localecom.ibm.icu.text.SimpleDateFormat
Method to return the format code according to format type and current localeMethod to return the format code according to format type and current localeget the string patternParses the input string into a formatted date type.
-
Field Details
-
DATETIME_UNFORMATTED
property: date time unformatted- See Also:
-
DATE_UNFORMATTED
property: date unformatted- See Also:
-
TIME_UNFORMATTED
property: time unformatted- See Also:
-
logger
logger used to log syntax errors.
-
-
Constructor Details
-
DateFormatter
public DateFormatter()Constructor method with no parameter -
DateFormatter
public DateFormatter(com.ibm.icu.util.TimeZone timeZone) Constructor- Parameters:
timeZone
-
-
DateFormatter
Constructor method with String parameter- Parameters:
pattern
-
-
DateFormatter
public DateFormatter(com.ibm.icu.util.ULocale localeLoc) Constructor method with Locale parameters- Parameters:
localeLoc
-
-
DateFormatter
public DateFormatter(com.ibm.icu.util.ULocale localeLoc, com.ibm.icu.util.TimeZone timeZone) Constructor- Parameters:
localeLoc
-timeZone
-
-
DateFormatter
Constructor method with two parameters, one is String type while the other is Locale type- Parameters:
pattern
-localeLoc
-
-
DateFormatter
public DateFormatter(String pattern, com.ibm.icu.util.ULocale localeLoc, com.ibm.icu.util.TimeZone timeZone) Constructor- Parameters:
pattern
- pattern of datelocaleLoc
- local of datetimeZone
- time zone of date
-
-
Method Details
-
getPattern
get the string pattern- Returns:
- Return the string pattern
-
applyPattern
Method to set the date/time format string- Parameters:
formatString
-
-
format
transfer the format string pattern from msdn to the string pattern which java can recognize- Parameters:
date
- Date to recognize the format of Java- Returns:
- Returns the analyst format of date
-
getFormatCode
Method to return format code according to format type and current locale- Returns:
- Returns format code according to format type and current locale
-
getLocalizedFormatCode
Method to return the format code according to format type and current locale- Returns:
- Returns format code according to format type and current locale
-
getFormatter
public com.ibm.icu.text.SimpleDateFormat getFormatter()Method to return the format code according to format type and current locale- Returns:
- Returns format code according to format type and current locale
-
parse
Parses the input string into a formatted date type.- Parameters:
date
- the input string to parse- Returns:
- the formatted date
- Throws:
ParseException
- if the beginning of the specified string cannot be parsed.
-
formatValue
Description copied from interface:IFormatter
format the value object into a string.- Specified by:
formatValue
in interfaceIFormatter
- Returns:
-