FileDocCategorySizeDatePackage
DateTimeDateFormat.javaAPI DocApache log4j 1.2.152427Sat Aug 25 00:09:40 BST 2007org.apache.log4j.helpers

DateTimeDateFormat

public class DateTimeDateFormat extends AbsoluteTimeDateFormat
Formats a {@link Date} in the format "dd MMM yyyy HH:mm:ss,SSS" for example, "06 Nov 1994 15:49:37,459".
author
Ceki Gülcü
since
0.7.5

Fields Summary
private static final long
serialVersionUID
String[]
shortMonths
Constructors Summary
public DateTimeDateFormat()


  
   
    super();
    shortMonths = new DateFormatSymbols().getShortMonths();
  
public DateTimeDateFormat(TimeZone timeZone)

    this();
    setCalendar(Calendar.getInstance(timeZone));
  
Methods Summary
public java.lang.StringBufferformat(java.util.Date date, java.lang.StringBuffer sbuf, java.text.FieldPosition fieldPosition)
Appends to sbuf the date in the format "dd MMM yyyy HH:mm:ss,SSS" for example, "06 Nov 1994 08:49:37,459".

param
sbuf the string buffer to write to


    calendar.setTime(date);

    int day = calendar.get(Calendar.DAY_OF_MONTH);
    if(day < 10)
      sbuf.append('0");
    sbuf.append(day);
    sbuf.append(' ");
    sbuf.append(shortMonths[calendar.get(Calendar.MONTH)]);
    sbuf.append(' ");

    int year =  calendar.get(Calendar.YEAR);
    sbuf.append(year);
    sbuf.append(' ");

    return super.format(date, sbuf, fieldPosition);
  
public java.util.Dateparse(java.lang.String s, java.text.ParsePosition pos)
This method does not do anything but return null.

    return null;