org.otfeed.support
Class DateFormat

java.lang.Object
  extended by org.otfeed.support.DateFormat
All Implemented Interfaces:
IFormat<java.util.Date>

public class DateFormat
extends java.lang.Object
implements IFormat<java.util.Date>

Date format helper. Default format is "MM/dd/yyyy HH:mm.ss". See documantation for java.text.SimpleDateFormat for the explanation of possible patterns.


Constructor Summary
DateFormat()
          Creates new DateFormat.
DateFormat(java.lang.String pattern)
          Creates new DateFormat from a given pattern.
 
Method Summary
 java.lang.String format(java.util.Date obj)
          Formats Date object to string.
 java.lang.String getPattern()
          Determines the date formatting/parsing pattern.
 java.util.Date parse(java.lang.String val)
          Parses Date object from a string.
 void setPattern(java.lang.String pattern)
          Sets pattern value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DateFormat

public DateFormat()
Creates new DateFormat. The default pattern is "MM/dd/yyyy HHH:mm.ss"


DateFormat

public DateFormat(java.lang.String pattern)
Creates new DateFormat from a given pattern.

Parameters:
pattern -
Method Detail

getPattern

public java.lang.String getPattern()
Determines the date formatting/parsing pattern.

Returns:
pattern value.

setPattern

public void setPattern(java.lang.String pattern)
Sets pattern value.

Parameters:
pattern -

format

public java.lang.String format(java.util.Date obj)
Formats Date object to string.

Specified by:
format in interface IFormat<java.util.Date>
Parameters:
obj - object to be formatted.
Returns:
string.

parse

public java.util.Date parse(java.lang.String val)
Parses Date object from a string.

Specified by:
parse in interface IFormat<java.util.Date>
Parameters:
val - string representation of an object.
Returns:
parsed object.


Copyright © 2007 Mike Kroutikov. All Rights Reserved.