1 21 package net.mlw.vlh.adapter.jdbc.util.setter; 22 23 import java.sql.PreparedStatement ; 24 import java.sql.SQLException ; 25 import java.text.ParseException ; 26 import java.text.SimpleDateFormat ; 27 import java.util.Date ; 28 29 34 public class SasDateSetter extends TimestampSetter 35 { 36 protected SimpleDateFormat formatter = new SimpleDateFormat (DEFAULT_FORMAT); 37 38 public static final String DEFAULT_SAS_FORMAT = "ddMMMyy"; 39 40 protected SimpleDateFormat sasFormatter = new SimpleDateFormat (DEFAULT_SAS_FORMAT); 41 42 45 public int set(PreparedStatement query, int index, Object value) throws SQLException , ParseException 46 { 47 Date date = formatter.parse((String ) value); 49 50 query.setString(index++, sasFormatter.format(date)); 52 return index; 53 } 54 55 58 public void setSasDateFormat(String format) 59 { 60 sasFormatter = new SimpleDateFormat (format); 61 } 62 } | Popular Tags |