日期必须遵循格式:yyyyMMddHHmmss.SSSZZZZZ

时间:2015-02-08 10:29:15

标签: java date datetime

TimeZone tz = TimeZone.getTimeZone("IST");
DateFormat df = new SimpleDateFormat("yyyyMMddHHmmss.SSSZZZZZ");
df.setTimeZone(tz);
String executionDate1 = df.format(new Date());
Date executionDate = df.parse(executionDate1);

以字符串格式给出20150208153355.141 + 0530。通过将其更改为日期格式,它变为:Sun Feb 08 15:33:55 IST 2015。

我正在尝试实施免疫计算器引擎(ICE)。该代码给出了免疫建议的评估时间:

我需要在以下日期使用此日期格式: CdsOutput result = service.evaluate(input.getCdsObject(),scopingEntityId,businessId,version,executionDate);

当我在Netbeans8.0.1(jdk7)(glassfish server4)中运行它时出错:

com.sun.xml.ws.fault.ServerSOAPFaultException: Client received SOAP Fault from server: tS2TSInternal(): getValue() is null; must follow format: yyyyMMddHHmmss.SSSZZZZZ Please see the server log to find more detail regarding exact cause of the failure.
    at com.sun.xml.ws.fault.SOAP12Fault.getProtocolException(SOAP12Fault.java:229)
    at com.sun.xml.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:125)
    at com.sun.xml.ws.client.sei.StubHandler.readResponse(StubHandler.java:253)
    at com.sun.xml.ws.db.DatabindingImpl.deserializeResponse(DatabindingImpl.java:181)
    at com.sun.xml.ws.db.DatabindingImpl.deserializeResponse(DatabindingImpl.java:258)
    at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:117)
    at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:91)
    at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:154)
    at com.sun.proxy.$Proxy462.evaluateAtSpecifiedTime(Unknown Source)
    at org.cdsframework.cds.service.OpenCdsService.evaluate(OpenCdsService.java:320)
    at org.cdsframework.cds.service.OpenCdsService.evaluate(OpenCdsService.java:228)
    at org.cdsframework.cds.service.OpenCdsService.evaluate(OpenCdsService.java:210)
    at org.mypackage.immunizations.processRequest(immunizations.java:185)
    at org.mypackage.immunizations.doGet(immunizations.java:273)

如何以日期格式yyyyMMddHHmmss.SSSZZZZZ获取日期? 我按照以前的答案编写了这段代码,但我仍然遇到错误。

0 个答案:

没有答案