format date and time

Hello!

What the format is for:
1) “xs:dateTime”
2) “xs:time”
3) “xs:date” ?

the examples:
1) “xs:dateTime”
YYYY-MM-DD HH:MM
DD-MM-YYY HH:MM
YY-DD-MM HH:MMpm
YY-DD-MM HH:MMam
??

2) “xs:time”
HH:MM
HH:MMpm
HH:MMam
??

3) “xs:date”
YYYY-MM-DD
YY-MM-DD
??


Questions:

1) How can I define separator for date format?
- “/”
- “-”
- “.”

2) How can I define format date for YYYY-MM-DD and how for YY-DD-MM?

3) How can I define format time for HH:MM (eg. 13:29) and how for HH:MM(am, pm) (eg. 01:29pm) ?

In advance, thanks a lot!

best regards,
Dariusz Baumann

I am no expert when it comes to XML Schema data types, but I am afraid, that the most the things you are describing, won’t work this way.

The value spaces and the lexical representations of built-in datatypes can be found here:

http://www.w3.org/TR/xmlschema-2/#built-in-datatypes

Please note, that different representations of the same data type make applications more complex and probably inefficient, that’s why the lexical space of xs:date is restricted to CCYY-MM-DD (see http://www.w3.org/TR/xmlschema-2/#date)

It looks like am, pm for xs:time is not allowed. In this case you have to use something like this:

1:20 pm for Eastern Standard Time which is 5 hours behind Coordinated Universal Time (UTC), one would write: 13:20:00-05:00
(see also: http://www.w3.org/TR/xmlschema-2/#time)

If you really want to create a user-defined datatype, representing date and time formats (I wouldn’t recommend this), then you have to use xs:token as base type, and constrain the value space by using xs:pattern facet (supported with the new Tamino 4.1.1)

Best regards,
Peter