DateToken.java :  » Development » jLo » org » jzonic » jlo » formatter » tokens » Java Open Source

Java Open Source » Development » jLo 
jLo » org » jzonic » jlo » formatter » tokens » DateToken.java
package org.jzonic.jlo.formatter.tokens;

import org.jzonic.jlo.LogRecord;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * User: Mecky
 * Date: 19.07.2005
 * Time: 12:17:49
 */
public class DateToken implements FormatterToken {

    private String df = "yyyy/MM/dd HH:mm:ss";

    public String format(LogRecord lr) {
        SimpleDateFormat formatter = new SimpleDateFormat(df);
        Date currentTime = new Date();
        String dateString = formatter.format(currentTime);
        return dateString;
    }

    public String getName() {
        return "date";
    }

    public void setParameterString(String txt) {
        df = txt;
    }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.