1 52 53 package freemarker.template; 54 55 63 public class SimpleDate implements TemplateDateModel 64 { 65 private final java.util.Date date; 66 private final int type; 67 68 72 public SimpleDate(java.sql.Date date) { 73 this(date, DATE); 74 } 75 76 80 public SimpleDate(java.sql.Time time) { 81 this(time, TIME); 82 } 83 84 88 public SimpleDate(java.sql.Timestamp datetime) { 89 this(datetime, DATETIME); 90 } 91 92 96 public SimpleDate(java.util.Date date, int type) { 97 if(date == null) { 98 throw new IllegalArgumentException ("date == null"); 99 } 100 this.date = date; 101 this.type = type; 102 } 103 104 public java.util.Date getAsDate() { 105 return date; 106 } 107 108 public int getDateType() { 109 return type; 110 } 111 112 public String toString() { 113 return date.toString(); 114 } 115 } 116 | Popular Tags |