FileDocCategorySizeDatePackage
DateFormatter.javaAPI DocExample2536Mon Jul 23 13:26:56 BST 2007org.apache.struts2.util

DateFormatter

public class DateFormatter extends Object
A bean that can be used to format dates

Fields Summary
Date
date
DateFormat
format
DateFormat
parser
Constructors Summary
public DateFormatter()

        this.parser = new SimpleDateFormat();
        this.format = new SimpleDateFormat();
        this.date = new Date();
    
Methods Summary
public java.util.DategetDate()

        return this.date;
    
public java.lang.StringgetFormattedDate()

        return format.format(date);
    
public voidsetDate(java.lang.String date)

        try {
            this.date = parser.parse(date);
        } catch (ParseException e) {
            throw new IllegalArgumentException(e.getMessage());
        }
    
public voidsetDate(java.util.Date date)

        this.date = date;
    
public voidsetDate(int date)

        setDate(Integer.toString(date));
    
public voidsetFormat(java.lang.String format)

        this.format = new SimpleDateFormat(format);
    
public voidsetFormat(java.text.DateFormat format)

        this.format = format;
    
public voidsetParseFormat(java.lang.String format)

        this.parser = new SimpleDateFormat(format);
    
public voidsetParser(java.text.DateFormat parser)

        this.parser = parser;
    
public voidsetTime(long time)

        date.setTime(time);