1数据库中该字段类型是datetime在java文件中我使用get、set方法时应该使用什么类型的变量?
2在表单中提取的系统时间是xx年xx月xx日xx时,请教该如何提取?

解决方案 »

  1.   

    提取的系统时间是xx年xx月xx日xx时的格式,请教该如何提取?
      

  2.   

    java.sql.TimeStamp 
    或者java.util.Date
      

  3.   

    提取的系统时间是xx年xx月xx日xx时的格式,请教该如何提取?
    举个例子
      

  4.   

    SimpleDateFormat c = new SimpleDateFormat("yyyy-MM-dd ");
        Date a = new Date();
        String b = (String)c.format(a);
        System.out.print(b);
      

  5.   

    刚好遇到类似楼主的问题,以下是我的解决办法
       Calendar temp = Calendar.getInstance();
       Date currentDate=new Date(temp.getTimeInMillis());
       Time currentTime=new Time(temp.getTimeInMillis());
       String sqlTime=currentDate.toString()+" "+currentTime.toString();输出格式为:yy-mm-dd hh:mm:ss