Last active
September 2, 2016 07:13
-
-
Save adammichalik/29e4d181409af312adab3a9f4ef6d6fe to your computer and use it in GitHub Desktop.
In response to http://stackoverflow.com/q/39170405/466738
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class JodaTimeSerializationTest { | |
@Test | |
public void serializeDateTime() throws JsonProcessingException { | |
DateTime dateTime = DateTime.parse("2016-01-01T00:00:00Z"); | |
ObjectMapper objectMapper = new ObjectMapper(); | |
objectMapper.registerModule(new JodaModule()); | |
objectMapper.configure(WRITE_DATES_AS_TIMESTAMPS , false); | |
System.out.println(objectMapper.writeValueAsString(dateTime)); // prints "2016-01-01T00:00:00.000Z" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment