乔达 ISODateTimeFormat serializing/deserializing

Joda ISODateTimeFormat serializing/deserializing

当我运行下面的测试时,它打印出“2016-11-11”。这里发生了什么?如何让它打印我作为输入提供的 DateTime 字符串?

import org.joda.time.DateTime;
import org.junit.Test;

public class Adapter2
    extends XmlAdapter<String, DateTime>
{


    public DateTime unmarshal(String value) {
        return (org.joda.time.format.ISODateTimeFormat.dateTimeParser().parseDateTime(value));
    }

    public String marshal(DateTime value) {
        return (org.joda.time.format.ISODateTimeFormat.dateTime().print(value));
    }
    
    @Test
    public void test()
    {
        System.out.println(new Adapter3().marshal(new Adapter3().unmarshal("2016-11-12T00:00:00.000+08:00")));
    }

}

使用 DateTime.parse() 而不是 ISODateTimeFormat.dateTimeParser().parseDateTime()。或使用 DateTime.parse() 使用的内容:

ISODateTimeFormat.dateTimeParser().withOffsetParsed().parseDateTime(value)