Ical4j Exdate属性拒绝从ical文件解析的utc Exdate末尾的Z。如何让它保留Z。我已经尝试删除EXDATE并用所需格式设置一个新的EXDATE,但它仍然不起作用,Z仍然被拒绝。请在下面找到我写的代码:
Iterator<Property> iterator = cal.getComponents().get(0).getProperties().iterator();
//This iterator iterates over the properties of the one component in a parsed out calendar "cal"
DateList list = new DateList(net.fortuna.ical4j.model.parameter.Value.DATE_TIME);
while (iterator.hasNext()) {
Property p = iterator.next();
if (p.getName().equals("EXDATE")) {
StringBuilder value = new StringBuilder(p.getValue());
value.append("Z");
System.out.println("New ExDate :" + value.toString());
Date date = new Date(value.toString(), "yyyyMMdd'T'hhmmss'Z'");
list.add(date);
iterator.remove();
}
}
if (!list.isEmpty()) {
cal.getComponents().get(0).getProperties().add(new ExDate(list));
}
for (final Property p : cal.getComponents().get(0).getProperties()) {
System.out.println(p.getName() + ":" + p.getValue());
}
获得的结果采用以下格式出厂日期:20151117t19000020151118t190000
我如何使它在时间戳的末尾保留Z,如"20151117T1900000Z",因为它导致我的客户不理解出厂日期并完全忽略它。这些值存储在caldav服务器中,然后客户端从那里提取
您是否尝试在DateList上执行setUtc(true)?