13位数的时间毫秒值应该用什么类型?且如何转换为("yyyy-MM-dd HH:mm:ss")格式的时间?
献上50分,谢谢

解决方案 »

  1.   

    13位数在数据库中只能用char(13)来存储了,SQL Server的int型存储不了那么大的整数.输出格式转换代码参考如下: SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    System.out.println("current time: "+sdf.format(new Date(System.currentTimeMillis())));
      

  2.   

    用String 格式,在数据库中用varchar, 取出来,对字符串进行解析
      

  3.   

    存入数据库10位,读取后还在其后加“000”再转换为yyyy-MM-dd HH:mm:ss格式,应该怎么做呢?
      

  4.   

    用long来存
    java.util.Date(long time) 设置你需要的显示格式
      

  5.   

    但是用13位超出了long的数值范围
      

  6.   

    好奇怪,long的范围不止13位吧,可他就是会出错说超范围
      

  7.   

    DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    Date ss = sdf.parse("2005-01-01 23:59:59");
      

  8.   

    Calendar cal = Calendar.getInstance();
          SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
          String date = formatter.format(cal.getTime());
    把格式任意改,改成你需要的格式就可以!