Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HELP!! Date format query

Status
Not open for further replies.

supascooper

Technical User
Mar 26, 2014
1
0
0
GB
I hope someone can assist:

I am setting up an XML output from our system to a third party vendor and I cannot get date elements to validate against their schema.

The schema sets the date format as:

- <xs:simpleType name="Date">
- <xs:restriction base="xs:string">
<xs:pattern value="^(((0[1-9]|[12]\d|3[01])\/(0[13578]|1[02])\/((19|[2-9]\d)\d{2}))|((0[1-9]|[12]\d|30)\/(0[13456789]|1[012])\/((19|[2-9]\d)\d{2}))|((0[1-9]|1\d|2[0-8])\/02\/((19|[2-9]\d)\d{2}))|(29\/02\/((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))))$" />
</xs:restriction>
</xs:simpleType>

I must confess I'm no XML expert and I'm finding it hard to work out the expected format from the above.

If anyone can help and enlighten me it would be greatly appreciated.

supascooper
 
Welcome to Tek-Tips!

DD/MM/YYYY

It is quite a complex regular expression that is dealing with a limited range of leap years and the normal complexities of the other months have 30 or 31 days. "Thirty days hath September..." in the form of a regular expression!

By the way, this is not the representation for a 'normal' XML date which would be xs:date. Too bad, as the XML date type is well defined.

Tom Morrison
Hill Country Software
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top