4

When I fill my date field with 28/12/12 08:51:51 and generate an XML file, I get the output 2028-12-12T08:51:51+00:00. In my XSD file, the type of this field is set as xs:dateTime.

The problem is that I only want the Date and Time, and not the time zone. So the output should be 2028-12-12T08:51:51

Does anybody know where this format is set?

Dave Moten
  • 11,957
  • 2
  • 40
  • 47
user1809753
  • 165
  • 3
  • 12
  • 1
    There are two aspects here: the [XML Schema definition for dateTime](http://www.w3.org/TR/xmlschema-2/#dateTime) specifies that the timezone is always allowed for dateTime (and defaults to UTC when not specified). That means your output is valid. Without knowing what tools you use to generate your XML it is impossible to suggest how to configure it to output a timestamp in UTC directly without explicitly adding timezone information. Can you include your code which generates the XML? – Wichert Akkerman Dec 28 '12 at 09:17

1 Answers1

1

Use the pattern as

YYYY-MM-DDThh:mm:ss

Do this way:-

<xsd:simpleType>
  <xsd:restriction base="xsd:dateTime">
    <xsd:pattern value="\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d" />
  </xsd:restriction>
</xsd:simpleType>
Siva Charan
  • 17,940
  • 9
  • 60
  • 95