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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can i specify Date Format in an XSD

Status
Not open for further replies.

Modica82

Technical User
Jan 31, 2003
410
GB
Hi all,

Is there a way i can specify the date format of a dataType within an XSD Schema?? I want to have the date in the format "MMMMM-YY-DD HH:MM:SS" Is this possible to enforce?

Thanks in advance,

Rob

---------------------------------------
 
XML uses ISO-8601 format:

yyyy-mm-ddThh:mm:ss

The "T" is a literal.

If you want another format, you can use a xs:string for the type, but then the XSD won't validate it for you (it's just a string at that point).

Chip H.


____________________________________________________________________
Click here to learn Ways to help with Tsunami Relief
If you want to get the best response to a question, please read FAQ222-2244 first
 
Sorry for my post, i was supposed to place the ISO-8601 format that chiph posted, why i used MMMM-YY-DD is beyond me, i was supposed to YYYY-MM-DD. If this is the default for XML then that is ok as its the one i want :D

Rob

---------------------------------------
 
On a somewhat related note, I needed to store a time interval in some XML this week. To enforce this via your XSD, you tell it to be of type xs:duration, in which case the XML value has to look like:
PnYnMnDTnHnMnS

So, for a 90 second duration, your value would be:
P0Y0M0DT0H1M30S

Chip H.


____________________________________________________________________
Click here to learn Ways to help with Tsunami Relief
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top