今天星期天啊,又修日过了啊,怎么没人回答啊.郁闷ing

解决方案 »

  1.   

    "2005-04-02 17:56:35.0".substring(12);
    0是微秒或毫秒什么的
      

  2.   

    可以使用java的Date类。但是需要自己转换,它取出来的是到1, 1970, 00:00:00 GMT.的时间长。
      

  3.   

    <%
    java.util.Date current=new java.util.Date();
    java.text.SimpleDateFormat formatter=new java.text.SimpleDateFormat("yyyy MM dd hh:mm:ss");//对时间的处理格式
    out.print(formatter.format(current));
    %>具体的别的参数你可以查阅java文档,你可以看看java.text.*包里面的对时间、对文本等的格式化类。
      

  4.   

    我的这时间是从数据库里面取出的,不是用jsp得到的.也就是字符串,这样的话,用上面的方法好像不大行吧!
      

  5.   

    不好意思上面没说清楚,我要的是日期,也就是2005-04-02.
    jfy3d(剑事) 的方法可以得到时间,也就是后面的12位.
    string.split支持空格吗?
    谢谢大家了.
      

  6.   

    "2005-04-02 17:56:35.0".substring(0,10);不就得了?
      

  7.   

    String time="2005-04-02 17:56:35.0";
    String tmp=time.subString(0,10);
    我用下面的代码它总是报如下的错误org.apache.jasper.JasperException: Unable to compile class for JSPAn error occurred at line: 20 in the jsp file: /jsp/time_split.jsp
    Generated servlet error:
    D:\Example\site\work\org\apache\jsp\jsp\time_005fsplit_jsp.java:82: cannot resolve symbol
    symbol  : method subString (int,int)
    location: class java.lang.String
    String tmp=time.subString(0,10);