日期:2014-05-20 浏览次数:20638 次
public class Date1{ public static void main(String[] args) { Date t = new Date(); t.setTime("2012-02-12 12:22:21"); System.out.println(t.toString()); } } class Date{ private String time; public void setTime(String value){ this.time = value; } public String getTime(){ return time; } public String toString() { String date="";; if(!"".equals(time)){ date=time.substring(0, 11); } return date; } }