Jsp页面时间显示格式问题

显示格式:年-月-日

  方法:1.加包import java.sql.Date; 而非import java.util.Date; //显示格式为:年-月-日··· 时:分:秒

     2.使用DateFormatter转换  :<s:date name="createDate" format="yyyy-MM-dd" />注意MM一定要大写,不然会不起作用或者时间显示不正常,因为在Java中,M(Mouth)表示“月”,而m(minute)表示“分”。

     3.字符串截取:String createDate=updatetime.get(0).toSting().substring(0,10);

原文地址:https://www.cnblogs.com/fzh20128387/p/3935695.html