1 16 17 package org.jboss.logging.jdk.format; 18 19 import java.text.DateFormatSymbols ; 20 import java.text.FieldPosition ; 21 import java.text.ParsePosition ; 22 import java.util.TimeZone ; 23 import java.util.Calendar ; 24 import java.util.Date ; 25 26 34 public class DateTimeDateFormat extends AbsoluteTimeDateFormat 35 { 36 37 String [] shortMonths; 38 39 public DateTimeDateFormat() 40 { 41 super(); 42 shortMonths = new DateFormatSymbols ().getShortMonths(); 43 } 44 45 public DateTimeDateFormat(TimeZone timeZone) 46 { 47 this(); 48 setCalendar(Calendar.getInstance(timeZone)); 49 } 50 51 57 public StringBuffer format(Date date, StringBuffer sbuf, 58 FieldPosition fieldPosition) 59 { 60 61 calendar.setTime(date); 62 63 int day = calendar.get(Calendar.DAY_OF_MONTH); 64 if (day < 10) 65 sbuf.append('0'); 66 sbuf.append(day); 67 sbuf.append(' '); 68 sbuf.append(shortMonths[calendar.get(Calendar.MONTH)]); 69 sbuf.append(' '); 70 71 int year = calendar.get(Calendar.YEAR); 72 sbuf.append(year); 73 sbuf.append(' '); 74 75 return super.format(date, sbuf, fieldPosition); 76 } 77 78 81 public Date parse(java.lang.String s, ParsePosition pos) 82 { 83 return null; 84 } 85 } 86 | Popular Tags |