DateTime format in XMLELEMENT function

Extensibility

DateTime format in XMLELEMENT function

I am trying to use the XMLELEMENT function to publish the current timestamp in a standard XML format.

I'm running code like this:

select sysxml.xmlelement ('xyz','','',cast(current_timestamp as timestamp with time zone))x

 from mytable

sample 1

;

I get the output:

<xyz>2013-12-11 11:31:45350000</xyz>

What I want is:

<xyz>2013-12-11T11:31:45+01:00</xyz>

Is there any way of doing this?

Thanks

Andy

1 REPLY

Re: DateTime format in XMLELEMENT function

Hi Andy,

I  run this code: select cast(current_timestamp as TIMESTAMP(6) WITH TIME ZONE);

Also I pull from my document  this info:

                                                                                 DATATYPE

TIMESTAMP ‘1999-10-01 11:37:58’--------------------- TIMESTAMP(0)

TIMESTAMP ‘1999-10-01 11:37:58-08:00’ -------------- TIMESTAMP(0) WITH TIME ZONE

TIMESTAMP ‘1999-10-01 11:37:58.213000+09:30’----------TIMESTAMP  WITH TIME ZONE

Hope it helps.

I dont have execute permission on sysxml.xmlelement

Cheers,

Raja