Can you help me to get the time format to match the XML dateTime?

XML has a dateTime format that looks like this:

2002-10 - 10T 12: 00:00 - 05:00

and Im using the XMLElement() functions in some queries to produce an xml document however it truncates the portions of time stored data is just MM/DD/YYYY.

I would use a to_char function but I don't know what date format in Oracle to use to match the portion of zone at the end (-05:00) and how to make so that it can accept as 't' in there as a separator, as defined in the XML schema specification:

http://www.w3.org/TR/xmlschema-2/

Anyone know?

Hello

Trant says:
XML has a dateTime format that looks like this:

2002-10 - 10T 12: 00:00 - 05:00

and Im using the XMLElement() functions in some queries to produce an xml document however it truncates the portions of time stored data is just MM/DD/YYYY.

I would use a to_char function but I don't know what date format in Oracle to use to match the portion of zone at the end (-05:00) and how to make so that it can accept as 't' in there as a separator, as defined in the XML schema specification:

http://www.w3.org/TR/xmlschema-2/

Anyone know?

Try something like

SELECT     TO_CHAR ( SYSTIMESTAMP
          , 'YYYY-MM-DD"T"HH24:MI:SSTZH:TZM'
          )
FROM     dual;

The sample output:

2011-07-25T15:50:12-04:00

TO_CHAR function is described in the SQL language reference manual:
http://download.Oracle.com/docs/CD/B28359_01/server.111/b28286/sql_elements004.htm#sthref396
Search for "Date Format models" in the index.

Put the mat (that is, fixed) text, for example the letter 'T', in the output, include it in double - quotes.
TZH is the hours and TZM time zone format specifier is synonymous of zone Minutes.

Tags: Database

Similar Questions

Maybe you are looking for