JAXB and xsd:date formatting
843834Jan 14 2003 — edited Mar 27 2003I have a simpleType defining a date with a pattern restriction. The jaxb compiler creates a setter method that expects a Calendar object. How dose on create a Calendar object of s specific format.
The schema fragment is as follows:
<xsd:simpleType name="LocalDateType">
<xsd:restriction base="xsd:date">
<xsd:pattern value="\d\d\d\d-\d\d-\d\d"/>
</xsd:restriction>
</xsd:simpleType>
Calendar rightNow = Calendar.getInstance(); returns: 2003-01-14-05:00
How do I get rid of the '-05:00' but maintain it as a Calendar object?
Using SimpleDateFormatter leaves you with a string:
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-dd-mm");
formattedRightNow = formatter.format(today); //formattedRightNow is a String