用SimpleDateFormate解析应该可以吧

解决方案 »

  1.   

    struts中有Validator,你看看它的使用吧,应该有方案
      

  2.   

    <%@ taglib prefix="fmt" uri = "http://java.sun.com/jsp/jstl/fmt" %>
     1  .<fmt:formatDate var="fmtDate" value="${time.logintime}"   dateStyle="full" timeStyle="full"/>
     ${fmtDate }
     2  .<fmt:formatDate var="fmtDate" value="${time.logintime}"   type="both"/>
     ${fmtDate }
      

  3.   

    <bean:write name="news" property="date" filter="true" format="yyyy-MM-dd"/>bean: news
    属性 : date 它是java.util.Date类型
    要格式化日期,添加filter="true"和format="yyyy年MM月dd日"
      

  4.   

    import java.util.Date;
    import java.text.SimpleDateFormat;
     
    public class Test {
           public static void main(String[] args) {
                  
                  Date date = new Date();
                  String strDate = "";
                  
                  SimpleDateFormat format = new SimpleDateFormat();
                  format.applyPattern("yyyy-MM-dd HH:mm:ss");
                  strDate = format.format(date);
                  System.out.println(strDate);
                  
                  format.applyPattern("yyyy-MM-dd");
                  strDate = format.format(date);
                  System.out.println(strDate);
                  
                  format.applyPattern("yyyyMMddHHmmss");
                  strDate = format.format(date);
                  System.out.println(strDate);
                  
                  format.applyPattern("yyyy'年'MM'月'dd'日'");
                  strDate = format.format(date);
                  System.out.println(strDate);
           }
     
    }
    用这个类吧
      

  5.   

    <bean:write>标签有个format属性,
    format="yyyy-MM-dd",应该就可以