Created
March 1, 2016 02:16
-
-
Save bdkosher/e8f28b23c7267e08e7af to your computer and use it in GitHub Desktop.
Using XMLGregorianCalendar to format dates.
This file contains hidden or 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
| import javax.xml.datatype.* | |
| def c = DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar()) | |
| c.setDay(1) | |
| c.setMonth(1) | |
| c.setYear(2016) | |
| c.setTime(0,0,0,0) | |
| c.setTimezone(0) | |
| assert '2016-01-01T00:00:00.000Z' == c.toXMLFormat() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment