All Forums Extensibility
andydoorey 35 posts Joined 05/09
11 Dec 2013
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

 

 

Raja_KT 1246 posts Joined 07/09
11 Dec 2013

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

Raja K Thaw
My wiki: http://en.wikipedia.org/wiki/User:Kt_raj1
Street Children suffer not by their fault. We can help them if we want.

You must sign in to leave a comment.