Package org.eclipse.birt.core.format

# Class DateFormatter

java.lang.Object
org.eclipse.birt.core.format.DateFormatter

All Implemented Interfaces:
  `IFormatter`

public class DateFormatter extends Object implements 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
Modifier and Type
Field
Description
`static final String`
`DATE_UNFORMATTED`
property: date unformatted
`static final String`
`DATETIME_UNFORMATTED`
property: date time unformatted
`protected static Logger`
`logger`
logger used to log syntax errors.
`static final String`
`TIME_UNFORMATTED`
property: time unformatted

## Constructor Summary

Constructors
Constructor
Description
`DateFormatter()`
Constructor method with no parameter
`DateFormatter(com.ibm.icu.util.TimeZone timeZone)`
Constructor
`DateFormatter(com.ibm.icu.util.ULocale localeLoc)`
Constructor method with Locale parameters
`DateFormatter(com.ibm.icu.util.ULocale localeLoc, com.ibm.icu.util.TimeZone timeZone)`
Constructor
`DateFormatter(String pattern)`
Constructor method with String parameter
`DateFormatter(String pattern, com.ibm.icu.util.ULocale localeLoc)`
Constructor method with two parameters, one is String type while the other is Locale type
`DateFormatter(String pattern, com.ibm.icu.util.ULocale localeLoc, com.ibm.icu.util.TimeZone timeZone)`
Constructor

## Method Summary

Modifier and Type
Method
Description
`void`
`applyPattern(String formatString)`
Method to set the date/time format string
`String`
`format(Date date)`
transfer the format string pattern from msdn to the string pattern which java can recognize
`String`
`formatValue(Object value)`
format the value object into a string.
`String`
`getFormatCode()`
Method to return format code according to format type and current locale
`com.ibm.icu.text.SimpleDateFormat`
`getFormatter()`
Method to return the format code according to format type and current locale
`String`
`getLocalizedFormatCode()`
Method to return the format code according to format type and current locale
`String`
`getPattern()`
get the string pattern
`Date`
`parse(String date)`
Parses the input string into a formatted date type.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### DATETIME_UNFORMATTED

public static final String DATETIME_UNFORMATTED
property: date time unformatted

See Also:
  - Constant Field Values

### DATE_UNFORMATTED

public static final String DATE_UNFORMATTED
property: date unformatted

See Also:
  - Constant Field Values

### TIME_UNFORMATTED

public static final String TIME_UNFORMATTED
property: time unformatted

See Also:
  - Constant Field Values

### logger

protected static Logger 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

public DateFormatter(String pattern)
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

public DateFormatter(String pattern, com.ibm.icu.util.ULocale localeLoc)
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 date
  `localeLoc` - local of date
  `timeZone` - time zone of date

## Method Details

### getPattern

public String getPattern()
get the string pattern

Returns:
  Return the string pattern

### applyPattern

public void applyPattern(String formatString)
Method to set the date/time format string

Parameters:
  `formatString` -

### format

public String format(Date date)
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

public String 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

public String 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

public Date parse(String date) throws ParseException
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

public String formatValue(Object value)
Description copied from interface: `IFormatter`
format the value object into a string.

Specified by:
  `formatValue` in interface `IFormatter`
Parameters:
  `value` -
Returns: