Hi,


When I use the below command it is throwing error



xs:dateTime('1970-01-01T00:00:00+00:00') + xs:duration('PT' || "1458797764507" 
|| 'S')



Error:



[1.0-ml] XDMP-EXPR: (err:XPTY0004) xs:dateTime("1970-01-01T00:00:00Z") + 
xs:duration("P16884233DT9H15M7S") -- Invalid expression



Stack trace:



at 1:41:

1: xs:dateTime('1970-01-01T00:00:00+00:00') + xs:duration('PT' || 
"1458797764507" || 'S')



-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Florent Georges
Sent: Friday, September 23, 2016 3:26 AM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] Convert unix timestamp to HH/MM/SS in 
marklogic



Hi,



You should be able to use the following expression, given $seconds is your 
timestamp, to get a date-time.  I am not sure about the limits on the number of 
seconds you can have in a duration, though:



xs:dateTime('1970-01-01T00:00:00+00:00')

   + xs:duration('PT' || $seconds || 'S')



Regards,



--

Florent Georges

http://fgeorges.org/

http://h2oconsulting.be/





On 23 September 2016 at 09:14, Debin, Infant Jerald (LNG-CON) wrote:

> Hi,

>

>

>

> Is there a way to convert the unix timestamp to HH/MM/SS format in marklogic

> using xquery.

>

>

>

> Unit timestamp that is in xml is in below ,

>

>

>

> <timestamp>1472812470453</timestamp>

>

>

>

> Thanks,

>

> Debin

>

>

> _______________________________________________

> General mailing list

> [email protected]<mailto:[email protected]>

> Manage your subscription at:

> http://developer.marklogic.com/mailman/listinfo/general

>

_______________________________________________

General mailing list

[email protected]<mailto:[email protected]>

Manage your subscription at:

http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to