Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
简单的问题:我应该使用什么格式来处理这个日期?
2011-10-09T05:06:03.000000Z
这个不起作用:
"yyyy-MM-dd'T'HH:mm:ssZZ"
来自手册:“时间戳是根据 epoch_ticks (zulu) 计算的,格式=%Y-%m-%dT%H:%M:%S.%fZ”
我认为简短的回答是“你不能”。由于某种原因,Java 不支持“Z”作为时区标识符。你可以做一个这样的解决方法:
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); df.setTimeZone(TimeZone.getTimeZone("UTC")); Date d = df.parse("2011-10-09T05:06:03.000000Z");
这假定日期为 UTC 并忽略 Z。
我在应用程序中使用 p:gmap 组件,但是当我尝试使用绑定属性来引用 bean 中的 GMap 时,它不起作用并且地图不显示。
JSF 代码:
<p:gmap binding="#{mapBean.map}" center=" -26.9995, -49.68