[英]How to display a date as ISO8601 with JSTL?
就像是?
<fmt:formatDate value="${event.starttime}" type="both"/>
It is not possible AFAIK. AFAIK是不可能的。 You can use the
pattern
attribute: 您可以使用
pattern
属性:
<fmt:formatDate pattern="yyyy-MM-dd'T'HH:mm:ssz" value="${event.starttime}" />
But there is not a pattern to generate ISO8601 without post-processing. 但是没有一种模式可以在没有后处理的情况下生成ISO8601。 You have to cook your date in the server side and show it in your view.
您必须在服务器端烹饪日期并在视图中显示。
You might find Joda-Time library useful, as well as some blog posts like: 您可能会发现Joda-Time库很有用,以及一些博客文章:
如果您不介意所有日期都是UTC(或修改后的其他硬编码时区),您可以使用:
<fmt:formatDate value="${event.starttime}" pattern="yyyy-MM-dd'T'HH:mm:ss'Z'" timeZone="UTC"/>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.