【发布时间】:2014-07-05 04:02:34
【问题描述】:
这个问题与: XmlBeans XmlDateTime format without timezone info
但我需要在没有任何时区信息的情况下在 XMLBeans 中打印日期。 我从万维网联盟读到的是:
“日期对象”是具有年、月和日属性的对象 像那些 dateTime 对象,加上一个 optional 时区值 时区属性
http://www.w3.org/TR/xmlschema-2/#date
关键字是可选。我需要从默认 XMLBeans 行为中删除它。
我尝试过的:
XmlDateTime xmlDateTime = XmlDateTime.Factory.newInstance();
xmlDateTime.setCalendarValue(new GregorianCalendar());
GDateBuilder gdb = new GDateBuilder(xmlDateTime.getDateValue());
gdb.normalize();
xmlDateTime.setGDateValue(gdb.toGDate());
instruction.setReqdExctnDt(gdb.getCalendar());
CBIPartyIdentification4 partyId = CBIPartyIdentification4.Factory.newInstance();
我得到的是2014-05-16Z 我需要的是2014-05-16。
我该怎么做?
【问题讨论】:
标签: java xml datetime xsd xmlbeans