Hi.
See attached testcase which uses cxf's jaxb adapters.
"2014-03-30+02:00" will yield 29/03/2014 in timezone Europe/Oslo - is this
correct?
--
--
David J. M. Karlsen - http://www.linkedin.com/in/davidkarlsen
import java.util.Date;
import org.apache.cxf.xjc.runtime.DataTypeAdapter;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
public class TestCase
{
@BeforeClass
public static void beforeClass() {
System.setProperty( "user.timezone", "Europe/Oslo" );
}
@Test
public void testData()
{
Date d = testIt( "2014-03-30Z" );
System.out.println(d.toGMTString());
assertIt( d );
//testIt( "2014-03-30+02:00" );
}
@Test
public void testWithTimezoneOffset() {
Date d = testIt( "2014-03-30+02:00" );
System.out.println(d.toGMTString());
assertIt( d );
}
private void assertIt( Date d ) {
Assert.assertEquals( 30, d.getDate() );
}
private Date testIt( String l )
{
Date d = DataTypeAdapter.parseDate( l );
return d;
}
}