Package org.bedework.util.struts
Class TimeDateFormatter
- java.lang.Object
-
- org.bedework.util.struts.TimeDateFormatter
-
- All Implemented Interfaces:
Serializable
public class TimeDateFormatter extends Object implements Serializable
Class to help in formatting of time and date strings. Allows callers to set the current date/time format.- Version:
- 1.0
- Author:
- Mike Douglass douglm@rpi.edu
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static intdatestatic intdateShortstatic intdateTimestatic intdateTimeShortstatic intdfltstatic inttimestatic inttimeDatestatic inttimeDateShortstatic inttimeShort
-
Constructor Summary
Constructors Constructor Description TimeDateFormatter()TimeDateFormatter(int style)TimeDateFormatter(int style, Locale l)TimeDateFormatter(String pattern)TimeDateFormatter(String pattern, Locale l)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Stringformat(Date val)Return a text representation of the Date objectDateparse(String val)voidsetPattern(String pattern)voidsetStyle(int style)voidsetStylePattern(int style, String pattern)
-
-
-
Field Detail
-
time
public static final int time
- See Also:
- Constant Field Values
-
date
public static final int date
- See Also:
- Constant Field Values
-
timeDate
public static final int timeDate
- See Also:
- Constant Field Values
-
dateTime
public static final int dateTime
- See Also:
- Constant Field Values
-
timeShort
public static final int timeShort
- See Also:
- Constant Field Values
-
dateShort
public static final int dateShort
- See Also:
- Constant Field Values
-
timeDateShort
public static final int timeDateShort
- See Also:
- Constant Field Values
-
dateTimeShort
public static final int dateTimeShort
- See Also:
- Constant Field Values
-
dflt
public static final int dflt
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
TimeDateFormatter
public TimeDateFormatter()
-
TimeDateFormatter
public TimeDateFormatter(int style)
- Parameters:
style- key
-
TimeDateFormatter
public TimeDateFormatter(int style, Locale l)- Parameters:
style- keyl- locale
-
TimeDateFormatter
public TimeDateFormatter(String pattern)
- Parameters:
pattern- for time/date
-
-
Method Detail
-
format
public String format(Date val)
Return a text representation of the Date object- Parameters:
val- Date- Returns:
- text representation of the Date object
-
parse
public Date parse(String val) throws Exception
- Parameters:
val- pattern for time/date- Returns:
- parsed parameter
- Throws:
Exception
-
setStyle
public void setStyle(int style)
- Parameters:
style- set to default locale
-
setStylePattern
public void setStylePattern(int style, String pattern)- Parameters:
style- keypattern- the pattern
-
setPattern
public void setPattern(String pattern)
- Parameters:
pattern- for time/date
-
-